๋ฌธ์ ๋ฅผ ์ ์ถํ๊ธฐ ์ ์ ๋ค์ ์ง๋ฌธ์ ๋ตํ์ญ์์ค. ๊ฐ์ฌ ํด์!
go version
)?์ด๋ ๋ฒ์ go1.8.3 linux/amd64
go env
)?์ฐ๋ถํฌ ๋ฆฌ๋ ์ค, amd64
๊ณต๊ธ์ ์ฒด ์ข ์์ฑ์ ๊ฐ์ ธ์ค๋ ํจํค์ง์์ golang.org/x/tools/cmd/stringer๋ฅผ ์คํํ๋ ค๊ณ ์๋ํ์ต๋๋ค.
๋๊ตฌ๊ฐ ์์๋๋ก ์๋ํฉ๋๋ค.
'go build' ๋ฐ ๊ธฐํ ๋ชจ๋ ๋๊ตฌ๋ $GOPATH/src/vendor์์ ๊ณต๊ธ๋๋ ์ข ์์ฑ์ผ๋ก ๋ฌธ์ ๊ฐ ์๋ ๊ฒ์ฒ๋ผ ๋ณด์ด์ง๋ง ๊ฐ์ ธ์ค๊ธฐ ์ค๋ฅ์ ํจ๊ป ์คํธ๋ง๊ฑฐ๊ฐ ์คํจํฉ๋๋ค.
$ go build plinth/auth
$ go get golang.org/x/tools/cmd/stringer
$ go generate plinth/auth
stringer: checking package: auth.go:8:2: could not import golang.org/x/net/context (can't find import: vendor/golang.org/x/net/context)
src/plinth/auth/auth.go:37: running "stringer": exit status 1
$ stringer -type Role $GOPATH/src/plinth/auth
stringer: checking package: [...]/src/plinth/auth/auth.go:8:2: could not import golang.org/x/net/context (can't find import: vendor/golang.org/x/net/context)
$ ls $GOPATH/src/vendor/golang.org/x/net/context
context.go context_test.go ctxhttp go17.go go19.go pre_go17.go pre_go19.go withtimeout_test.go
์ฐ๋ฆฌ๋ ์ด ๋ฌธ์ ๋ฅผ ๊ฒช๊ณ ์์ต๋๋ค. https://travis-ci.org/stripe/veneur/builds/278659663์์ ๋ณผ ์ ์๋ฏ์ด Go 1.8์์๋ง ๋ํ๋ฉ๋๋ค. Go 1.9 ๋์ Go 1.8์ ์ฌ์ฉ ํ๋๋ก ํด๋น pull ์์ฒญ ์ Dockerfile์ ๋ณ๊ฒฝํ์ฌ ๋ก์ปฌ์์ ์ฌํํ ์ ์์ต๋๋ค. ์ฐพ์ ์ ์๋ ํจํค์ง(์ด ๊ฒฝ์ฐ github.com/gogo/protobuf/proto
)๊ฐ go install
๋ก ์ค์น๋ ๊ฒฝ์ฐ์๋ ๋ฐ์ํฉ๋๋ค.
์คํธ๋ง๊ฑฐ ์ํฌํฐ๋ 1.8์ฉ ๊ธฐ๋ณธ Go ์ํฌํฐ๋ฅผ ์ฌ์ฉํ์ง๋ง 1.9์ฉ์ ์ฌ์ฉํ์ง ์์ต๋๋ค .
Stringer๋ฅผ ์คํํ๊ธฐ ์ ์ ํ์ฌ ํ๋ก์ ํธ์์ go install
๋ฅผ ์คํํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋ฉ๋๋ค.
stringer
์์ ์ด๊ฒ์ ์์ ํ๋ ค๊ณ ์๋ํ์ง๋ง go/importer
์์ฒด์ ๋์์ด ์ด๋ฐ ์์ผ๋ก 1.8๊ณผ 1.9 ์ฌ์ด์์ ๋ณ๊ฒฝ๋ ์ด์ ๋ ํ์คํ์ง ์์ต๋๋ค. ๋๊ตฐ๊ฐ ์ฌ๊ธฐ์์ ์ฌ๋ฐ๋ฅธ ๋ฐฉํฅ์ผ๋ก ๋๋ฅผ ๊ฐ๋ฆฌํฌ ์ ์์ต๋๊น?
์ด ๋ฌธ์ ๋ Go 1.10์์ ์์ ๋์์ง๋ง ์ต๊ทผ์ ๋ค์ ๋์ ๋์์ต๋๋ค. ๋๋ ๊ทธ๊ฒ์ ๋์ ํ ์ปค๋ฐ์ด CL 40403์ ๋๋๋ฆฌ๋ https://github.com/golang/tools/commit/ffe88906718454e356e61776b54256e873fc133b ๋ผ๊ณ ํ์ ํฉ๋๋ค.
https://github.com/golang/go/issues/25650 ์ ํด๊ฒฐํ๊ธฐ ์ํด ์ปค๋ฐ์ด ๋๋๋ ค์ก์ง๋ง ๊ด๋ จ์ด ์๋ https://github.com/golang/go/issues/10249 ๋ฅผ ๋ค์ ๋์ ํฉ๋๋ค.
์๋ ๋์ด ๋๋ฌธ์ ์ ๊ฒจ ์์๊ธฐ ๋๋ฌธ์ ํด๋น ๋ฌธ์ ์ ๋ํด ์ธ๊ธํ ์ ์์ต๋๋ค. ์ดํ ์ ์ ๋ค์ ์ด๋ ธ์ง๋ง ์ฌ์ ํ ๊ณต๋ ์์ ์๋ก ์ ํ๋์ด ์์ต๋๋ค.
@ChimeraCoder #10249 ์ ๊ธ์ ํด์ ํ์ต๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
@ChimeraCoder #10249 ์ ๊ธ์ ํด์ ํ์ต๋๋ค.