#Keeping `go.mod` in `ci/`

1 messages · Page 1 of 1 (latest)

slender geyser
#

Hey @vapid locust what you could do is put your go.mod file inside the ci folder and set the workdir of the dagger client like so client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout), dagger.WithWorkdir("..")).

vapid locust
#

That shouldn't work?

dagger run go run ci/main.go
ci/main.go:8:2: no required module provides package dagger.io/dagger: go.mod file not found in current directory or any parent directory; see 'go help modules'
go run ci/main.go
ci/main.go:8:2: no required module provides package dagger.io/dagger: go.mod file not found in current directory or any parent directory; see 'go help modules'
#

That's just from hello-dagger with standard setup from quick start (modified so that dagger context sets workdir back a directory)

slender geyser
#

Okay I understand. So the solution I described requires to cd into ci first. Is that a problem?

vapid locust
#

Well, it seems to be broken if you cd into the ci directory as well

#
[howdoicomputer@framework:~/workspace/hello-dagger/ci]$ dagger run go run main.go
╮ 
▽ init
█ [0.87s] connect
┣ [0.79s] starting engine
┣ [0.01s] starting session
┻ 
█ [0.24s] ERROR go run main.go
┃ panic: cannot configure workdir for existing session (please use --workdir or host.directory with absolute paths instead)                                                          
┃ Please visit https://dagger.io/help#go for troubleshooting guidance.                                                                                                               
┃                                                                                                                                                                                    
┃ goroutine 1 [running]:                                                                                                                                                             
┃ main.main()                                                                                                                                                                        
┃     /home/howdoicomputer/workspace/hello-dagger/ci/main.go:17 +0x474                                                                                                               
┃ exit status 2                                                                                                                                                                      
┻ 
• Engine: e335164544fa (version v0.8.4)
• Duration: 239ms
⧗ 1.11s ✔ 3 ✘ 1
exit status 1
#

Maybe a regression? I swear I had this working for an earlier version of Dagger.

slender geyser
#

So how does the output look like if you run it directly via go run main.go inside ci?