makefile: build

This commit is contained in:
Simon Vieille 2022-08-22 00:00:05 +02:00
parent c0bdfa469f
commit 0e08a84842
Signed by: deblan
GPG Key ID: 579388D585F70417
3 changed files with 13 additions and 4 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/bin/*

8
Makefile Normal file
View File

@ -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 .

View File

@ -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))
}