728x90
소스는 문제가 없다.
server.go
package main
import (
"net/http"
"github.com/labstack/echo"
)
func main() {
e := echo.New()
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
})
e.Logger.Fatal(e.Start(":1323"))
}
터미널에서go run server.go 를 실행시켰더니 아래와 같이 에러가 났다.
go: inconsistent vendoring in C:\Go\src: github.com/labstack/echo/v4@v4.1.17: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt golang.org/x/crypto@v0.0.0-20200820211705-5c72a883971a: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt golang.org/x/crypto@v0.0.0-20200622213623-75b288015ac9: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod golang.org/x/sys@v0.0.0-20200501145240-bc7a7d42d5c3: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod golang.org/x/text@v0.3.3-0.20200430171850-afb9336c4530: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod run 'go mod vendor' to sync, or use -mod=mod or -mod=readonly to ignore the vendor directory |
물론 go get -u 를 했을 때
go get .: path C:\Go\src\echotest is not a package in module rooted at C:\Go\src; |
프로젝트를 포함시켜야 하는데 안해서 나는 에러
go mod init "your-app-name"
이름을 echotest 라고 했을 때
go mod init echotest
하고 나서 실행시키니 정상으로 서버가 가동 됨.
728x90