lint/.automation/test/go/golang_good_02.go
Masaya Suzuki 2ecb464fad
Fix golangci-lint failure in slim image (#2746)
* Add golang test case

* Add go install

* Add go file

* Fix install command

* Move go.mod and go.sum

* slim image also pull in libs

* Use go 1.17

* Update README of GO test case
2022-04-11 11:42:01 -05:00

31 lines
454 B
Go

package main
import (
"github.com/go-playground/validator/v10"
"github.com/labstack/echo/v4"
)
type FooType struct {
Var *string `validate:"alphanum"`
}
func post(c echo.Context) (err error) {
validate := validator.New()
if err = validate.Struct(FooType{Var: nil}); err != nil {
return
}
return
}
func server() (e *echo.Echo) {
e = echo.New()
e.POST("/", post)
return
}
func main() {
e := server()
e.Logger.Fatal(e.Start(":8000"))
}