Skip to content

Commit

Permalink
Make app/ a Go module.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaq committed Feb 22, 2024
1 parent 99a414a commit 8ed7629
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN apk --no-cache add git make rsync zip python3 py3-beautifulsoup4 coreutils

# Build app
COPY app /app
RUN go build -o /app/up /app/up.go
RUN cd /app && go build -o up .

# Set up user and directories.
RUN adduser -D -g '' builder
Expand Down
3 changes: 3 additions & 0 deletions app/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/elves/up/app

go 1.22.0
6 changes: 3 additions & 3 deletions app/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"encoding/hex"
"encoding/json"
"flag"
"io/ioutil"
"io"
"log"
"net/http"
"os"
Expand All @@ -29,7 +29,7 @@ type Payload struct {
func main() {
flag.Parse()

secretBytes, err := ioutil.ReadFile(*secretFlag)
secretBytes, err := os.ReadFile(*secretFlag)
if err != nil {
log.Fatalln("failed to read secret file:", err)
}
Expand All @@ -40,7 +40,7 @@ func main() {

http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
log.Println("handling request")
payload, err := ioutil.ReadAll(r.Body)
payload, err := io.ReadAll(r.Body)
if err != nil {
log.Println("failed to read HTTP request:", err)
return
Expand Down

0 comments on commit 8ed7629

Please sign in to comment.