diff --git a/Dockerfile b/Dockerfile index 65f756b..5987265 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ COPY . . RUN go build -o bin/us-dop-api \ -ldflags "-X main.Shortsha=${SHORTSHA} \ -X main.Version=${version} \ - -X main.Aarch=${TARGETARCH}" ./cmd + -X main.Aarch=${TARGETARCH}" ./cmd/api/main.go FROM alpine AS runner WORKDIR /app diff --git a/cmd/api/main.go b/cmd/api/main.go index f8e302f..66df4de 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -1,7 +1,6 @@ package main import ( - "html/template" "io/fs" "log/slog" "net/http" @@ -21,7 +20,7 @@ import ( var ( hostSTR = os.Getenv("HOST)") portSTR = os.Getenv("PORT") - templ template.Template + ) func main() { diff --git a/internal/handlers/api/api.go b/internal/handlers/api/api.go index 54a409a..e624a97 100644 --- a/internal/handlers/api/api.go +++ b/internal/handlers/api/api.go @@ -45,6 +45,6 @@ func NewApiHandler( dolar ports.DolarService, log *slog.Logger, templ template.T // instParseHTML // // Can be much tipe of html part of a list, a form, a card etc... -func instParseHTML(SearchResult) string { +/* func instParseHTML(SearchResult) string { return "html" -} +}*/ diff --git a/internal/handlers/api/constrols.go b/internal/handlers/api/constrols.go index 69e9fa1..a937232 100644 --- a/internal/handlers/api/constrols.go +++ b/internal/handlers/api/constrols.go @@ -3,9 +3,9 @@ package api import "net/http" func (api *API) GetHistoryPage(w http.ResponseWriter, r *http.Request) { - api.templ.ExecuteTemplate(w, "hist-page", nil) + _ = api.templ.ExecuteTemplate(w, "hist-page", nil) } func (api *API) GetComparisonPage(w http.ResponseWriter, r *http.Request) { - api.templ.ExecuteTemplate(w, "compare-page", nil) + _ = api.templ.ExecuteTemplate(w, "compare-page", nil) } diff --git a/internal/handlers/api/institution.go b/internal/handlers/api/institution.go index 4d563a4..6462960 100644 --- a/internal/handlers/api/institution.go +++ b/internal/handlers/api/institution.go @@ -98,7 +98,7 @@ func (api *API) GetInstitutionHistory(w http.ResponseWriter, r *http.Request) { } } else { data, _ := json.Marshal(searchRes) - w.Write(data) + _, _ = w.Write(data) } } @@ -115,7 +115,10 @@ func (api *API) GetInstNames(w http.ResponseWriter, r *http.Request) { w.Header().Set("Etag", "institutions") w.Header().Set("Cache-Control", "max-age=3600") - var institutions, err = []string{}, *new(error) + var ( + institutions []string + err = *new(error) + ) switch inst { case "bancos", "banco": inst = "bancos" @@ -179,7 +182,7 @@ func (api *API) GetInstNames(w http.ResponseWriter, r *http.Request) { if err != nil { fmt.Println(err) } - w.Write(dat) + _, _ = w.Write(dat) } } @@ -194,7 +197,7 @@ func (api *API) GetLatestPrice(w http.ResponseWriter, r *http.Request) { api.log.Error("geting latest price", "error", err) http.NotFound(w, r) } - api.templ.ExecuteTemplate(w, "latest-price", price) + _ = api.templ.ExecuteTemplate(w, "latest-price", price) } func (api *API) GetAllLatestPrice(w http.ResponseWriter, r *http.Request) { @@ -222,5 +225,5 @@ func (api *API) GetAllLatestPrice(w http.ResponseWriter, r *http.Request) { } instLastPriceList = append(instLastPriceList, in) } - api.templ.ExecuteTemplate(w, "latest-price", instLastPriceList) + _ = api.templ.ExecuteTemplate(w, "latest-price", instLastPriceList) } diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index 47a4b0d..7cd3e1d 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -39,7 +39,7 @@ func NewRoot(dolar ports.DolarService, log *slog.Logger, files []string) *Root { } r.HandleFunc("/{$}", func(w http.ResponseWriter, r *http.Request) { - templ.ExecuteTemplate(w, "index", nil) + _ = templ.ExecuteTemplate(w, "index", nil) //w.Write([]byte("{'status': 'ok'}")) }) inst := api.NewApiHandler( dolar, log, templ) @@ -51,7 +51,7 @@ func NewRoot(dolar ports.DolarService, log *slog.Logger, files []string) *Root { // telegram r.HandleFunc("/telegram/{$}", func(w http.ResponseWriter, r *http.Request) { - templ.ExecuteTemplate(w, "index", nil) + _ = templ.ExecuteTemplate(w, "index", nil) //w.Write([]byte("{'status': 'ok'}")) })