Go: cmd / go : buildmode = plugin์€ ํ•ญ์ƒ ๋ชจ๋“  ์ข…์†์„ฑ์„ ๋‹ค์‹œ ์ปดํŒŒ์ผํ•ฉ๋‹ˆ๋‹ค.

์— ๋งŒ๋“  2017๋…„ 03์›” 25์ผ  ยท  1๋…ผํ‰  ยท  ์ถœ์ฒ˜: golang/go

go version go1.8 linux/amd64

๋ญ ํ–ˆ์–ด?

์˜ˆ๋ฅผ ๋“ค๋ฉด

package main
var V int
go build -buildmode=plugin -v test/main.go

๋ฌด์—‡์„ ๊ธฐ๋Œ€ ํ–ˆ์Šต๋‹ˆ๊นŒ?

lion@Lion-Laptop [ test ] $ go build -buildmode=plugin -v test/main.go
command-line-arguments
lion@Lion-Laptop [ test ] $ 

๋Œ€์‹  ๋ฌด์—‡์„ ๋ณด์•˜์Šต๋‹ˆ๊นŒ?

lion@Lion-Laptop [ test ] $ go build -buildmode=plugin -v test/main.go
runtime/internal/sys
runtime/internal/atomic
runtime
runtime/cgo
command-line-arguments
lion@Lion-Laptop [ test ] $ 

-a ๋กœ ๊ฑด๋ฌผ๊ณผ ๋™์ผ

NeedsFix help wanted

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

๋ชจ๋“  ํŒจํ‚ค์ง€๋Š” ๋™์  ์—ฐ๊ฒฐ์„ ์œ„ํ•ด ๊ตฌ์„ฑ๋œ ๋„๊ตฌ ๋ชจ์Œ์œผ๋กœ ๋‹ค์‹œ ๋นŒ๋“œํ•ด์•ผํ•˜๋ฉฐ ๊ธฐ๋ณธ์ ์œผ๋กœ go build ๋Š” ์ค‘๊ฐ„ ํŒจํ‚ค์ง€ ๋นŒ๋“œ๋ฅผ ์บ์‹œํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ๋‚˜๋Š” cmd / go์— ๋Œ€ํ•œ ์ž‘์—…์ด ๊ทธ๊ฒƒ์„ ๋ฐ”๊ฟ€ ๊ฒƒ์ด๋ผ๊ณ  ๋ฏฟ๋Š”๋‹ค. ๊ทธ๋ฆฌ๊ณ ์ด ๋ฌธ์ œ๋Š” ์‚ฌ๋ผ์งˆ ๊ฒƒ์ด๋‹ค.

๊ทธ๋•Œ๊นŒ์ง€๋Š” ์ค‘๊ฐ„ ํŒจํ‚ค์ง€ ๋นŒ๋“œ๋ฅผ ์บ์‹œํ•˜๊ธฐ ์œ„ํ•ด ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ๋นŒ๋“œ ํ•  ๋•Œ -i ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์ด๋Š” ์ฒ˜์Œ์—๋งŒ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

$ go build -buildmode=plugin -i -v plugin1
runtime/internal/sys
runtime/internal/atomic
runtime
common
internal/cpu
errors
unicode/utf8
sync/atomic
unicode
internal/race
math
sync
syscall
strconv
reflect
runtime/cgo
plugin1
$ go build -buildmode=plugin -i -v plugin1
plugin1
$

>๋ชจ๋“  ๋Œ“๊ธ€

๋ชจ๋“  ํŒจํ‚ค์ง€๋Š” ๋™์  ์—ฐ๊ฒฐ์„ ์œ„ํ•ด ๊ตฌ์„ฑ๋œ ๋„๊ตฌ ๋ชจ์Œ์œผ๋กœ ๋‹ค์‹œ ๋นŒ๋“œํ•ด์•ผํ•˜๋ฉฐ ๊ธฐ๋ณธ์ ์œผ๋กœ go build ๋Š” ์ค‘๊ฐ„ ํŒจํ‚ค์ง€ ๋นŒ๋“œ๋ฅผ ์บ์‹œํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ๋‚˜๋Š” cmd / go์— ๋Œ€ํ•œ ์ž‘์—…์ด ๊ทธ๊ฒƒ์„ ๋ฐ”๊ฟ€ ๊ฒƒ์ด๋ผ๊ณ  ๋ฏฟ๋Š”๋‹ค. ๊ทธ๋ฆฌ๊ณ ์ด ๋ฌธ์ œ๋Š” ์‚ฌ๋ผ์งˆ ๊ฒƒ์ด๋‹ค.

๊ทธ๋•Œ๊นŒ์ง€๋Š” ์ค‘๊ฐ„ ํŒจํ‚ค์ง€ ๋นŒ๋“œ๋ฅผ ์บ์‹œํ•˜๊ธฐ ์œ„ํ•ด ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ๋นŒ๋“œ ํ•  ๋•Œ -i ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์ด๋Š” ์ฒ˜์Œ์—๋งŒ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

$ go build -buildmode=plugin -i -v plugin1
runtime/internal/sys
runtime/internal/atomic
runtime
common
internal/cpu
errors
unicode/utf8
sync/atomic
unicode
internal/race
math
sync
syscall
strconv
reflect
runtime/cgo
plugin1
$ go build -buildmode=plugin -i -v plugin1
plugin1
$
์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰