xorpaul/g10k

"panic: assignment to entry in nil map" with 0.5.3 and master

cruwe opened this issue · 3 comments

cruwe commented

With 0.5.3 and master, I observe when calling via cmdline

g10k -cachedir=./tmp -puppetfile -verbose -tags 

or IntelliJ

GOROOT=/usr/lib/go-1.10 #gosetup
GOPATH=/home/cjr/media/src/go #gosetup
/usr/lib/go-1.10/bin/go build -o /tmp/___go_build_github_com_xorpaul_g10k -gcflags "all=-N -l" . #gosetup
/home/cjr/.IntelliJIdea2018.2/config/plugins/intellij-go/lib/dlv/linux/dlv --listen=localhost:46573 --headless=true --api-version=2 --backend=default exec /tmp/___go_build_github_com_xorpaul_g10k -- -puppetfile -cachedir=./tmp #gosetup
panic: assignment to entry in nil map

goroutine 119 [running]:
main.syncToModuleDir(0xc4203da5a0, 0x48, 0xc4203ee330, 0x10, 0xc42026e27c, 0x5, 0x0, 0x83c3e3, 0xc, 0x0)
	/home/cjr/media/src/go/src/github.com/xorpaul/g10k/git.go:165 +0x1270
main.resolvePuppetfile.func3(0xc420120fe0, 0xc4204ae0d0, 0xa, 0xc420472020, 0x839d51, 0x2, 0xc420472010, 0xc420270990, 0xc42026e21f, 0x5, ...)
	/home/cjr/media/src/go/src/github.com/xorpaul/g10k/puppetfile.go:330 +0xbd7
created by main.resolvePuppetfile
	/home/cjr/media/src/go/src/github.com/xorpaul/g10k/puppetfile.go:276 +0x19b5

I do not understand the intent of

if _, ok := needSyncEnvs[correspondingPuppetEnvironment]; !ok {
			needSyncEnvs[correspondingPuppetEnvironment] = struct{}{}
		}

I imagine that because I have no mapping of module branches to environments, ok == false, but after that, I am lost. Do I miss some braking change in invocation? Thanks and thanks for your work on g10k.

The global map needSyncEnvs was not initialized when run in -puppetfile mode. I've overlooked this, because it doesn't make sense that there is more than 1 modified Puppet environment, when running in -puppetfile mode.

I fixed it in v0.5.4 https://github.com/xorpaul/g10k/releases/tag/v0.5.4

The intent of needSyncEnvs is to get a list of all modified Puppet environments, mainly for the postrun command, see #112 (comment)

cruwe commented

Thank you!

Thank you for pointing this out! 😏