From 0e08a8484207fa404eed0c8b8c70a8c663315e2d Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Mon, 22 Aug 2022 00:00:05 +0200 Subject: [PATCH] makefile: build --- .gitignore | 1 + Makefile | 8 ++++++++ main.go | 8 ++++---- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b450d4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/bin/* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c0b8d69 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +build: fmt + CGO_ENABLED=0 go build -ldflags '-s -w' -v -o bin/main ./ + +tool-gofumpt: + which golangci-lint > /dev/null 2>&1 || go install mvdan.cc/gofumpt@latest + +fmt: tool-gofumpt + gofumpt -w --extra . diff --git a/main.go b/main.go index 662c9df..d470b49 100644 --- a/main.go +++ b/main.go @@ -3,12 +3,13 @@ package main import ( "encoding/json" "fmt" - "github.com/labstack/echo/v4" - "github.com/labstack/echo/v4/middleware" - "github.com/urfave/cli/v2" "net/http" "os" "path/filepath" + + "github.com/labstack/echo/v4" + "github.com/labstack/echo/v4/middleware" + "github.com/urfave/cli/v2" ) var Commands = []*cli.Command{} @@ -97,7 +98,6 @@ func apiList(ctx echo.Context, directory, url string) error { return nil }) - if err != nil { return ctx.String(http.StatusInternalServerError, fmt.Sprintf("{\"error\":\"%s\"", err)) }