IT 이야기/디버깅

[go 언어] go: cannot find main module; see 'go help modules'Build process exiting with code: 1 signal: null 오류

왼손잡이 에언 2021. 2. 22. 17:14

// 언어: go lang

// 에디터: vs code

// 에러 메세지:

go: cannot find main module; see 'go help modules'
Build process exiting with code: 1 signal: null

 

Hello world에서 오류를 만나다니.. 

// 해결방법

cmd 창을 열어서 

go env -w GO111MODULE=auto

로 설정을 바꿔주면 된다.

 

// 해결과정

처음에 검색을 했더니 한글로 된 문서는 없었다.. 

github.com/golang/go/issues/31997

 

question: "go: cannot find main module; see 'go help modules'" · Issue #31997 · golang/go

What did you do? If possible, provide a recipe for reproducing the error. A complete runnable program is good. A link on play.golang.org is best. creating a file hello.go in /home/ubuntu/go/src/hel...

github.com

여기서 문제를 해결할 수 있었다! 

21년 2월 22일 기준 17시간 전에 달린 댓글에서 걸어준 링크를 참조해 해결할 수 있었다.

blog.golang.org/go116-module-changes

 

New module changes in Go 1.16 - The Go Blog

Jay Conrod 18 February 2021 We hope you're enjoying Go 1.16! This release has a lot of new features, especially for modules. The release notes describe these changes briefly, but let's explore a few of them in depth. Modules on by default The go command no

blog.golang.org

정확한 해석은 아니지만 대충 새로운 모듈이 업데이트 되면서 디폴드 되어 있던 모듈을 변경해줘야한다고 한다. 선택지가 넓어졌고  GO111MODULE 를 auto로 설정이 가능해졌다고 합니다