From e1dc759ce814ea3ba8bd318bf80f288ddf59ba69 Mon Sep 17 00:00:00 2001 From: Rahul De Date: Wed, 14 Aug 2024 09:20:42 +0100 Subject: [PATCH] [housekeeping] fix DIR_NAME --- README.md | 2 +- main.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bcc2f23..75404d4 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This is a simple artifact store enabling Bob to store build artifacts. #### Requirements -- [Go](https://golang.org/dl/) 1.18+ +- [Go](https://golang.org/dl/) 1.22+ #### Running - `go build main.go` to compile the code and obtain a binary `main`. diff --git a/main.go b/main.go index 3804610..4c05d21 100644 --- a/main.go +++ b/main.go @@ -16,6 +16,8 @@ import ( "path/filepath" ) +const DIR_NAME = "artifacts" + func ping(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "Ack") } @@ -71,7 +73,7 @@ func delete(w http.ResponseWriter, r *http.Request) { } func send(w http.ResponseWriter, r *http.Request) { - http.ServeFile(w, r, filepath.Join("artifacts", r.PathValue("artifactPath"))) + http.ServeFile(w, r, filepath.Join(DIR_NAME, r.PathValue("artifactPath"))) } func main() {