Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

[Dúvida] erro com middleware

n to entendo o erro...

github.com/Led-New/Go_apit_Rert/middleware

middleware\middleware.go:8:9: http.HandleFunc(func(w http.ResponseWriter, r *http.Request) {…}) (no value) used as value middleware\middleware.go:8:25: not enough arguments in call to http.HandleFunc have (func(w http.ResponseWriter, r *http.Request)) want (string, func(http.ResponseWriter, *http.Request))

    package middleware

import ( "net/http" )

func ContentTypeMiddleware(next http.Handler) http.Handler { return http.HandleFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-type", "application/json") next.ServeHTTP(w, r) }) }

1 resposta
solução!

erro encontrado "http.HandleFunc" , coloca por "http.HandlerFunc"