status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
timestamp[us, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
dagger/dagger
https://github.com/dagger/dagger
5,911
POST http://dagger/query rpc error
Every Dagger run has something like: ``` [0.08s] Failed to connect; retrying... name:"error" value:"make request: Post \"http://dagger/query\": rpc error: code = Unknown desc = server \"wu4a6pa0asl96zq39iaijneaq\" not found" ``` It seems like it can be safely ignored, but the error message is concerning.
https://github.com/dagger/dagger/issues/5911
https://github.com/dagger/dagger/pull/5918
70609dd344b7703de9ea52e2162ea574358e3fda
572bd3de9340dea4121627163f4f7b58c818beb4
2023-10-18T17:09:08Z
go
2023-10-19T17:12:45Z
engine/client/client.go
if data != nil { dataBytes, err := json.Marshal(resp.Data) if err != nil { return fmt.Errorf("marshal data: %w", err) } err = json.Unmarshal(dataBytes, data) if err != nil { return fmt.Errorf("unmarshal data: %w", err) } } return nil } func (c *Client) ServeHTTP(w http.ResponseWriter, r *http.Request) { ctx, cancel, err := c.withClientCloseCancel(r.Context()) if err != nil { w.WriteHeader(http.StatusBadGateway) w.Write([]byte("client has closed: " + err.Error())) return } r = r.WithContext(ctx) defer cancel() if c.SecretToken != "" { username, _, ok := r.BasicAuth() if !ok || username != c.SecretToken { w.Header().Set("WWW-Authenticate", `Basic realm="Access to the Dagger engine session"`) w.WriteHeader(http.StatusUnauthorized) return } } proxyReq := &http.Request{
closed
dagger/dagger
https://github.com/dagger/dagger
5,911
POST http://dagger/query rpc error
Every Dagger run has something like: ``` [0.08s] Failed to connect; retrying... name:"error" value:"make request: Post \"http://dagger/query\": rpc error: code = Unknown desc = server \"wu4a6pa0asl96zq39iaijneaq\" not found" ``` It seems like it can be safely ignored, but the error message is concerning.
https://github.com/dagger/dagger/issues/5911
https://github.com/dagger/dagger/pull/5918
70609dd344b7703de9ea52e2162ea574358e3fda
572bd3de9340dea4121627163f4f7b58c818beb4
2023-10-18T17:09:08Z
go
2023-10-19T17:12:45Z
engine/client/client.go
Method: r.Method, URL: &url.URL{ Scheme: "http", Host: "dagger", Path: r.URL.Path, }, Header: r.Header, Body: r.Body, } proxyReq = proxyReq.WithContext(ctx) resp, err := c.httpClient.Do(proxyReq) if err != nil { w.WriteHeader(http.StatusBadGateway) w.Write([]byte("http do: " + err.Error())) return } defer resp.Body.Close() for k, v := range resp.Header { w.Header()[k] = v } w.WriteHeader(resp.StatusCode) _, err = io.Copy(w, resp.Body) if err != nil { panic(err) } } func (c *Client) Dagger() *dagger.Client { return c.daggerClient } type AnyDirSource struct{}
closed
dagger/dagger
https://github.com/dagger/dagger
5,911
POST http://dagger/query rpc error
Every Dagger run has something like: ``` [0.08s] Failed to connect; retrying... name:"error" value:"make request: Post \"http://dagger/query\": rpc error: code = Unknown desc = server \"wu4a6pa0asl96zq39iaijneaq\" not found" ``` It seems like it can be safely ignored, but the error message is concerning.
https://github.com/dagger/dagger/issues/5911
https://github.com/dagger/dagger/pull/5918
70609dd344b7703de9ea52e2162ea574358e3fda
572bd3de9340dea4121627163f4f7b58c818beb4
2023-10-18T17:09:08Z
go
2023-10-19T17:12:45Z
engine/client/client.go
func (s AnyDirSource) Register(server *grpc.Server) { filesync.RegisterFileSyncServer(server, s) } func (s AnyDirSource) TarStream(stream filesync.FileSync_TarStreamServer) error { return fmt.Errorf("tarstream not supported") }
closed
dagger/dagger
https://github.com/dagger/dagger
5,911
POST http://dagger/query rpc error
Every Dagger run has something like: ``` [0.08s] Failed to connect; retrying... name:"error" value:"make request: Post \"http://dagger/query\": rpc error: code = Unknown desc = server \"wu4a6pa0asl96zq39iaijneaq\" not found" ``` It seems like it can be safely ignored, but the error message is concerning.
https://github.com/dagger/dagger/issues/5911
https://github.com/dagger/dagger/pull/5918
70609dd344b7703de9ea52e2162ea574358e3fda
572bd3de9340dea4121627163f4f7b58c818beb4
2023-10-18T17:09:08Z
go
2023-10-19T17:12:45Z
engine/client/client.go
func (s AnyDirSource) DiffCopy(stream filesync.FileSync_DiffCopyServer) error { opts, err := engine.LocalImportOptsFromContext(stream.Context()) if err != nil { return fmt.Errorf("get local import opts: %w", err) } if opts.ReadSingleFileOnly { fileContents, err := os.ReadFile(opts.Path) if err != nil { return fmt.Errorf("read file: %w", err) } if len(fileContents) > int(opts.MaxFileSize) { return fmt.Errorf("file contents too large: %d > %d", len(fileContents), opts.MaxFileSize) } return stream.SendMsg(&filesync.BytesMessage{Data: fileContents}) } return fsutil.Send(stream.Context(), stream, fsutil.NewFS(opts.Path, &fsutil.WalkOpt{ IncludePatterns: opts.IncludePatterns, ExcludePatterns: opts.ExcludePatterns, FollowPaths: opts.FollowPaths, Map: func(p string, st *fstypes.Stat) fsutil.MapResult { st.Uid = 0 st.Gid = 0 return fsutil.MapResultKeep }, }), nil) } type AnyDirTarget struct{}
closed
dagger/dagger
https://github.com/dagger/dagger
5,911
POST http://dagger/query rpc error
Every Dagger run has something like: ``` [0.08s] Failed to connect; retrying... name:"error" value:"make request: Post \"http://dagger/query\": rpc error: code = Unknown desc = server \"wu4a6pa0asl96zq39iaijneaq\" not found" ``` It seems like it can be safely ignored, but the error message is concerning.
https://github.com/dagger/dagger/issues/5911
https://github.com/dagger/dagger/pull/5918
70609dd344b7703de9ea52e2162ea574358e3fda
572bd3de9340dea4121627163f4f7b58c818beb4
2023-10-18T17:09:08Z
go
2023-10-19T17:12:45Z
engine/client/client.go
func (t AnyDirTarget) Register(server *grpc.Server) { filesync.RegisterFileSendServer(server, t) } func (AnyDirTarget) DiffCopy(stream filesync.FileSend_DiffCopyServer) (rerr error) { opts, err := engine.LocalExportOptsFromContext(stream.Context()) if err != nil { return fmt.Errorf("get local export opts: %w", err) } if !opts.IsFileStream { if err := os.MkdirAll(opts.Path, 0o700); err != nil { return fmt.Errorf("failed to create synctarget dest dir %s: %w", opts.Path, err) } err := fsutil.Receive(stream.Context(), stream, opts.Path, fsutil.ReceiveOpt{ Merge: true, Filter: func(path string, stat *fstypes.Stat) bool { stat.Uid = uint32(os.Getuid()) stat.Gid = uint32(os.Getgid()) return true }, }) if err != nil { return fmt.Errorf("failed to receive fs changes: %w", err) } return nil }
closed
dagger/dagger
https://github.com/dagger/dagger
5,911
POST http://dagger/query rpc error
Every Dagger run has something like: ``` [0.08s] Failed to connect; retrying... name:"error" value:"make request: Post \"http://dagger/query\": rpc error: code = Unknown desc = server \"wu4a6pa0asl96zq39iaijneaq\" not found" ``` It seems like it can be safely ignored, but the error message is concerning.
https://github.com/dagger/dagger/issues/5911
https://github.com/dagger/dagger/pull/5918
70609dd344b7703de9ea52e2162ea574358e3fda
572bd3de9340dea4121627163f4f7b58c818beb4
2023-10-18T17:09:08Z
go
2023-10-19T17:12:45Z
engine/client/client.go
allowParentDirPath := opts.AllowParentDirPath fileOriginalName := opts.FileOriginalName var destParentDir string var finalDestPath string stat, err := os.Lstat(opts.Path) switch { case errors.Is(err, os.ErrNotExist): destParentDir = filepath.Dir(opts.Path) finalDestPath = opts.Path case err != nil: return fmt.Errorf("failed to stat synctarget dest %s: %w", opts.Path, err) case !stat.IsDir(): destParentDir = filepath.Dir(opts.Path) finalDestPath = opts.Path case !allowParentDirPath: return fmt.Errorf("destination %q is a directory; must be a file path unless allowParentDirPath is set", opts.Path) default: if fileOriginalName == "" {
closed
dagger/dagger
https://github.com/dagger/dagger
5,911
POST http://dagger/query rpc error
Every Dagger run has something like: ``` [0.08s] Failed to connect; retrying... name:"error" value:"make request: Post \"http://dagger/query\": rpc error: code = Unknown desc = server \"wu4a6pa0asl96zq39iaijneaq\" not found" ``` It seems like it can be safely ignored, but the error message is concerning.
https://github.com/dagger/dagger/issues/5911
https://github.com/dagger/dagger/pull/5918
70609dd344b7703de9ea52e2162ea574358e3fda
572bd3de9340dea4121627163f4f7b58c818beb4
2023-10-18T17:09:08Z
go
2023-10-19T17:12:45Z
engine/client/client.go
return fmt.Errorf("cannot export container tar to existing directory %q", opts.Path) } destParentDir = opts.Path finalDestPath = filepath.Join(destParentDir, fileOriginalName) } if err := os.MkdirAll(destParentDir, 0o700); err != nil { return fmt.Errorf("failed to create synctarget dest dir %s: %w", destParentDir, err) } if opts.FileMode == 0 { opts.FileMode = 0o600 } destF, err := os.OpenFile(finalDestPath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, opts.FileMode) if err != nil { return fmt.Errorf("failed to create synctarget dest file %s: %w", finalDestPath, err) } defer destF.Close() for { msg := filesync.BytesMessage{} if err := stream.RecvMsg(&msg); err != nil { if errors.Is(err, io.EOF) { return nil } return err } if _, err := destF.Write(msg.Data); err != nil { return err } } } type progRockAttachable struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,911
POST http://dagger/query rpc error
Every Dagger run has something like: ``` [0.08s] Failed to connect; retrying... name:"error" value:"make request: Post \"http://dagger/query\": rpc error: code = Unknown desc = server \"wu4a6pa0asl96zq39iaijneaq\" not found" ``` It seems like it can be safely ignored, but the error message is concerning.
https://github.com/dagger/dagger/issues/5911
https://github.com/dagger/dagger/pull/5918
70609dd344b7703de9ea52e2162ea574358e3fda
572bd3de9340dea4121627163f4f7b58c818beb4
2023-10-18T17:09:08Z
go
2023-10-19T17:12:45Z
engine/client/client.go
writer progrock.Writer } func (a progRockAttachable) Register(srv *grpc.Server) { progrock.RegisterProgressServiceServer(srv, progrock.NewRPCReceiver(a.writer)) } const ( cacheConfigEnvName = "_EXPERIMENTAL_DAGGER_CACHE_CONFIG" cacheImportsConfigEnvName = "_EXPERIMENTAL_DAGGER_CACHE_IMPORT_CONFIG" cacheExportsConfigEnvName = "_EXPERIMENTAL_DAGGER_CACHE_EXPORT_CONFIG" ) func cacheConfigFromEnv(envName string) ([]*controlapi.CacheOptionsEntry, error) { envVal, ok := os.LookupEnv(envName) if !ok { return nil, nil } configKVs := strings.Split(envVal, ";") for i := len(configKVs) - 2; i >= 0; i-- { if strings.HasSuffix(configKVs[i], `\`) { configKVs[i] = configKVs[i][:len(configKVs[i])-1] + ";" + configKVs[i+1]
closed
dagger/dagger
https://github.com/dagger/dagger
5,911
POST http://dagger/query rpc error
Every Dagger run has something like: ``` [0.08s] Failed to connect; retrying... name:"error" value:"make request: Post \"http://dagger/query\": rpc error: code = Unknown desc = server \"wu4a6pa0asl96zq39iaijneaq\" not found" ``` It seems like it can be safely ignored, but the error message is concerning.
https://github.com/dagger/dagger/issues/5911
https://github.com/dagger/dagger/pull/5918
70609dd344b7703de9ea52e2162ea574358e3fda
572bd3de9340dea4121627163f4f7b58c818beb4
2023-10-18T17:09:08Z
go
2023-10-19T17:12:45Z
engine/client/client.go
configKVs = append(configKVs[:i+1], configKVs[i+2:]...) } } cacheConfigs := make([]*controlapi.CacheOptionsEntry, 0, len(configKVs)) for _, kvsStr := range configKVs { kvs := strings.Split(kvsStr, ",") if len(kvs) == 0 { continue } attrs := make(map[string]string) for _, kv := range kvs { parts := strings.SplitN(kv, "=", 2) if len(parts) != 2 { return nil, fmt.Errorf("invalid form for cache config %q", kv) } attrs[parts[0]] = parts[1] } typeVal, ok := attrs["type"] if !ok { return nil, fmt.Errorf("missing type in cache config: %q", envVal) } delete(attrs, "type") cacheConfigs = append(cacheConfigs, &controlapi.CacheOptionsEntry{ Type: typeVal, Attrs: attrs, }) } return cacheConfigs, nil } func allCacheConfigsFromEnv() (cacheImportConfigs []*controlapi.CacheOptionsEntry, cacheExportConfigs []*controlapi.CacheOptionsEntry, rerr error) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,911
POST http://dagger/query rpc error
Every Dagger run has something like: ``` [0.08s] Failed to connect; retrying... name:"error" value:"make request: Post \"http://dagger/query\": rpc error: code = Unknown desc = server \"wu4a6pa0asl96zq39iaijneaq\" not found" ``` It seems like it can be safely ignored, but the error message is concerning.
https://github.com/dagger/dagger/issues/5911
https://github.com/dagger/dagger/pull/5918
70609dd344b7703de9ea52e2162ea574358e3fda
572bd3de9340dea4121627163f4f7b58c818beb4
2023-10-18T17:09:08Z
go
2023-10-19T17:12:45Z
engine/client/client.go
cacheImportConfigs, err := cacheConfigFromEnv(cacheImportsConfigEnvName) if err != nil { return nil, nil, fmt.Errorf("cache import config from env: %w", err) } cacheExportConfigs, err = cacheConfigFromEnv(cacheExportsConfigEnvName) if err != nil { return nil, nil, fmt.Errorf("cache export config from env: %w", err) } cacheConfigs, err := cacheConfigFromEnv(cacheConfigEnvName) if err != nil { return nil, nil, fmt.Errorf("cache config from env: %w", err) } for _, cfg := range cacheConfigs { cacheImportConfigs = append(cacheImportConfigs, cfg) cacheExportConfigs = append(cacheExportConfigs, cfg) } return cacheImportConfigs, cacheExportConfigs, nil } type doerWithHeaders struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,911
POST http://dagger/query rpc error
Every Dagger run has something like: ``` [0.08s] Failed to connect; retrying... name:"error" value:"make request: Post \"http://dagger/query\": rpc error: code = Unknown desc = server \"wu4a6pa0asl96zq39iaijneaq\" not found" ``` It seems like it can be safely ignored, but the error message is concerning.
https://github.com/dagger/dagger/issues/5911
https://github.com/dagger/dagger/pull/5918
70609dd344b7703de9ea52e2162ea574358e3fda
572bd3de9340dea4121627163f4f7b58c818beb4
2023-10-18T17:09:08Z
go
2023-10-19T17:12:45Z
engine/client/client.go
inner graphql.Doer headers http.Header } func (d doerWithHeaders) Do(req *http.Request) (*http.Response, error) { for k, v := range d.headers { req.Header[k] = v } return d.inner.Do(req) } func EngineConn(engineClient *Client) DirectConn { return func(req *http.Request) (*http.Response, error) { req.SetBasicAuth(engineClient.SecretToken, "") resp := httptest.NewRecorder() engineClient.ServeHTTP(resp, req) return resp.Result(), nil } } type DirectConn func(*http.Request) (*http.Response, error) func (f DirectConn) Do(r *http.Request) (*http.Response, error) { return f(r) } func (f DirectConn) Host() string { return ":mem:" } func (f DirectConn) Close() error { return nil }
closed
dagger/dagger
https://github.com/dagger/dagger
5,930
🐞 Can't hide secrets in Git Clones
### What is the issue? Discord here -> https://discord.com/channels/707636530424053791/1164639553865383947 I must use HTTPS / GH Token, can't use SSH for git clones. There is no way for me to hide credentials that are in the git https url. The below snippet will print my `please-dont-print` password all over the place :( ```golang package main import ( "context" "os" "dagger.io/dagger" log "github.com/sirupsen/logrus" ) func main() { var err error ctx := context.Background() c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout), dagger.WithLogOutput(os.Stderr)) if err != nil { log.Error(err) } gitUrlRaw := "https://username:please-dont-print@github.com/dagger/dagger" c.SetSecret("ghApiToken", gitUrlRaw) src := c.Git(gitUrlRaw, dagger.GitOpts{KeepGitDir: true}). Branch("main"). Tree() c.Container().WithMountedDirectory("/src", src).WithExec([]string{"ls", "-la", "/src"}).Stdout(ctx) } ``` ### Log output ``` ➜ dagger-debug dagger run go run . ┣─╮ │ ▽ init │ █ [1.49s] connect │ ┣ [1.16s] starting engine │ ┣ [0.20s] starting session │ ┻ █ [2.64s] go run . █ [0.72s] git://stobias123:please-dont-print@github.com/dagger/dagger#main ┃ 94c8f92d7dd99616e4c6db05e5d0e4cd94ab13d6 refs/heads/main █ [0.22s] ERROR exec ls -la /src ``` ### Steps to reproduce run above snippet ### SDK version 0.8.7 ### OS version osx
https://github.com/dagger/dagger/issues/5930
https://github.com/dagger/dagger/pull/5951
752f324037801df10c9598c50eee0577d22a7f24
69bd45f6f777c6e8a949176e2d6014fd6388b812
2023-10-19T20:20:00Z
go
2023-10-24T09:59:36Z
core/secret.go
package core import ( "context" "errors" "sync" "github.com/dagger/dagger/core/resourceid" "github.com/dagger/dagger/engine/buildkit" "github.com/moby/buildkit/session/secrets" "github.com/opencontainers/go-digest" ) type Secret struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,930
🐞 Can't hide secrets in Git Clones
### What is the issue? Discord here -> https://discord.com/channels/707636530424053791/1164639553865383947 I must use HTTPS / GH Token, can't use SSH for git clones. There is no way for me to hide credentials that are in the git https url. The below snippet will print my `please-dont-print` password all over the place :( ```golang package main import ( "context" "os" "dagger.io/dagger" log "github.com/sirupsen/logrus" ) func main() { var err error ctx := context.Background() c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout), dagger.WithLogOutput(os.Stderr)) if err != nil { log.Error(err) } gitUrlRaw := "https://username:please-dont-print@github.com/dagger/dagger" c.SetSecret("ghApiToken", gitUrlRaw) src := c.Git(gitUrlRaw, dagger.GitOpts{KeepGitDir: true}). Branch("main"). Tree() c.Container().WithMountedDirectory("/src", src).WithExec([]string{"ls", "-la", "/src"}).Stdout(ctx) } ``` ### Log output ``` ➜ dagger-debug dagger run go run . ┣─╮ │ ▽ init │ █ [1.49s] connect │ ┣ [1.16s] starting engine │ ┣ [0.20s] starting session │ ┻ █ [2.64s] go run . █ [0.72s] git://stobias123:please-dont-print@github.com/dagger/dagger#main ┃ 94c8f92d7dd99616e4c6db05e5d0e4cd94ab13d6 refs/heads/main █ [0.22s] ERROR exec ls -la /src ``` ### Steps to reproduce run above snippet ### SDK version 0.8.7 ### OS version osx
https://github.com/dagger/dagger/issues/5930
https://github.com/dagger/dagger/pull/5951
752f324037801df10c9598c50eee0577d22a7f24
69bd45f6f777c6e8a949176e2d6014fd6388b812
2023-10-19T20:20:00Z
go
2023-10-24T09:59:36Z
core/secret.go
Name string `json:"name,omitempty"` } func NewDynamicSecret(name string) *Secret { return &Secret{ Name: name, } } func (secret *Secret) Clone() *Secret { cp := *secret return &cp } func (secret *Secret) ID() (SecretID, error) { return resourceid.Encode(secret) } func (secret *Secret) Digest() (digest.Digest, error) { return stableDigest(secret) } var ErrNotFound = errors.New("secret not found") func NewSecretStore() *SecretStore { return &SecretStore{ secrets: map[string][]byte{}, } } var _ secrets.SecretStore = &SecretStore{} type SecretStore struct { mu sync.Mutex
closed
dagger/dagger
https://github.com/dagger/dagger
5,930
🐞 Can't hide secrets in Git Clones
### What is the issue? Discord here -> https://discord.com/channels/707636530424053791/1164639553865383947 I must use HTTPS / GH Token, can't use SSH for git clones. There is no way for me to hide credentials that are in the git https url. The below snippet will print my `please-dont-print` password all over the place :( ```golang package main import ( "context" "os" "dagger.io/dagger" log "github.com/sirupsen/logrus" ) func main() { var err error ctx := context.Background() c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout), dagger.WithLogOutput(os.Stderr)) if err != nil { log.Error(err) } gitUrlRaw := "https://username:please-dont-print@github.com/dagger/dagger" c.SetSecret("ghApiToken", gitUrlRaw) src := c.Git(gitUrlRaw, dagger.GitOpts{KeepGitDir: true}). Branch("main"). Tree() c.Container().WithMountedDirectory("/src", src).WithExec([]string{"ls", "-la", "/src"}).Stdout(ctx) } ``` ### Log output ``` ➜ dagger-debug dagger run go run . ┣─╮ │ ▽ init │ █ [1.49s] connect │ ┣ [1.16s] starting engine │ ┣ [0.20s] starting session │ ┻ █ [2.64s] go run . █ [0.72s] git://stobias123:please-dont-print@github.com/dagger/dagger#main ┃ 94c8f92d7dd99616e4c6db05e5d0e4cd94ab13d6 refs/heads/main █ [0.22s] ERROR exec ls -la /src ``` ### Steps to reproduce run above snippet ### SDK version 0.8.7 ### OS version osx
https://github.com/dagger/dagger/issues/5930
https://github.com/dagger/dagger/pull/5951
752f324037801df10c9598c50eee0577d22a7f24
69bd45f6f777c6e8a949176e2d6014fd6388b812
2023-10-19T20:20:00Z
go
2023-10-24T09:59:36Z
core/secret.go
secrets map[string][]byte bk *buildkit.Client } func (store *SecretStore) SetBuildkitClient(bk *buildkit.Client) { store.bk = bk } func (store *SecretStore) AddSecret(_ context.Context, name string, plaintext []byte) (SecretID, error) { store.mu.Lock() defer store.mu.Unlock() secret := NewDynamicSecret(name) store.secrets[secret.Name] = plaintext return secret.ID() } func (store *SecretStore) GetSecret(ctx context.Context, idOrName string) ([]byte, error) { store.mu.Lock() defer store.mu.Unlock() var name string if secret, err := SecretID(idOrName).Decode(); err == nil { name = secret.Name } else { name = idOrName } plaintext, ok := store.secrets[name] if !ok { return nil, ErrNotFound } return plaintext, nil }
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
package main import ( "context" "encoding/json" "fmt" "os" "path/filepath" "sort" "strings" "dagger.io/dagger" "github.com/dagger/dagger/core/modules" "github.com/dagger/dagger/engine/client" "github.com/iancoleman/strcase" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/vito/progrock" ) var ( moduleURL string moduleFlags = pflag.NewFlagSet("module", pflag.ContinueOnError) sdk string moduleName string moduleRoot string ) const ( moduleURLDefault = "." ) func init() {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
moduleFlags.StringVarP(&moduleURL, "mod", "m", "", "Path to dagger.json config file for the module or a directory containing that file. Either local path (e.g. \"/path/to/some/dir\") or a git repo (e.g. \"git://github.com/dagger/dagger?ref=branch?subpath=path/to/some/dir\").") moduleFlags.BoolVar(&focus, "focus", true, "Only show output for focused commands.") moduleCmd.PersistentFlags().AddFlagSet(moduleFlags) listenCmd.PersistentFlags().AddFlagSet(moduleFlags) queryCmd.PersistentFlags().AddFlagSet(moduleFlags) funcCmds.AddFlagSet(moduleFlags) moduleInitCmd.PersistentFlags().StringVar(&sdk, "sdk", "", "SDK name or image ref to use for the module") moduleInitCmd.MarkPersistentFlagRequired("sdk") moduleInitCmd.PersistentFlags().StringVar(&moduleName, "name", "", "Name of the new module") moduleInitCmd.MarkPersistentFlagRequired("name") moduleInitCmd.PersistentFlags().StringVarP(&moduleRoot, "root", "", "", "Root directory that should be loaded for the full module context. Defaults to the parent directory containing dagger.json.") moduleCmd.AddCommand(moduleInitCmd) moduleCmd.AddCommand(moduleUseCmd) moduleCmd.AddCommand(moduleSyncCmd) } var moduleCmd = &cobra.Command{ Use: "module", Aliases: []string{"mod"}, Short: "Manage dagger modules",
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
Long: "Manage dagger modules. By default, print the configuration of the specified module in json format.", Hidden: true, RunE: func(cmd *cobra.Command, args []string) error { ctx := cmd.Context() return withEngineAndTUI(ctx, client.Params{}, func(ctx context.Context, engineClient *client.Client) (err error) { mod, _, err := getModuleFlagConfig(ctx, engineClient.Dagger()) if err != nil { return fmt.Errorf("failed to get module: %w", err) } var cfg *modules.Config switch { case mod.Local: cfg, err = mod.Config(ctx, nil) if err != nil { return fmt.Errorf("failed to get local module config: %w", err) } case mod.Git != nil: rec := progrock.FromContext(ctx) vtx := rec.Vertex("get-mod-config", strings.Join(os.Args, " ")) defer func() { vtx.Done(err) }() readConfigTask := vtx.Task("reading git module config") cfg, err = mod.Config(ctx, engineClient.Dagger()) readConfigTask.Done(err) if err != nil { return fmt.Errorf("failed to get git module config: %w", err) } } cfgBytes, err := json.MarshalIndent(cfg, "", " ") if err != nil { return fmt.Errorf("failed to marshal module config: %w", err)
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
} cmd.Println(string(cfgBytes)) return nil }) }, } var moduleInitCmd = &cobra.Command{ Use: "init", Short: "Initialize a new dagger module in a local directory.", Hidden: false, RunE: func(cmd *cobra.Command, _ []string) (rerr error) { ctx := cmd.Context() return withEngineAndTUI(ctx, client.Params{}, func(ctx context.Context, engineClient *client.Client) (err error) { dag := engineClient.Dagger() mod, _, err := getModuleFlagConfig(ctx, dag) if err != nil { return fmt.Errorf("failed to get module: %w", err) } if mod.Git != nil { return fmt.Errorf("module init is not supported for git modules") } if exists, err := mod.modExists(ctx, nil); err == nil && exists { return fmt.Errorf("module init config path already exists: %s", mod.Path) } cfg := modules.NewConfig(moduleName, sdk, moduleRoot) return updateModuleConfig(ctx, engineClient, mod, cfg, cmd) }) }, } var moduleUseCmd = &cobra.Command{
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
Use: "use", Short: "Add a new dependency to a dagger module", Hidden: false, RunE: func(cmd *cobra.Command, extraArgs []string) (rerr error) { ctx := cmd.Context() return withEngineAndTUI(ctx, client.Params{}, func(ctx context.Context, engineClient *client.Client) (err error) { modFlagCfg, _, err := getModuleFlagConfig(ctx, engineClient.Dagger()) if err != nil { return fmt.Errorf("failed to get module: %w", err) } if modFlagCfg.Git != nil { return fmt.Errorf("module use is not supported for git modules") } modCfg, err := modFlagCfg.Config(ctx, engineClient.Dagger()) if err != nil { return fmt.Errorf("failed to get module config: %w", err) } var deps []string deps = append(deps, modCfg.Dependencies...) deps = append(deps, extraArgs...) depSet := make(map[string]*modules.Ref) for _, dep := range deps { depMod, err := modules.ResolveModuleDependency(ctx, engineClient.Dagger(), modFlagCfg.Ref, dep) if err != nil { return fmt.Errorf("failed to get module: %w", err) } depSet[depMod.Symbolic()] = depMod } modCfg.Dependencies = nil for _, dep := range depSet {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
modCfg.Dependencies = append(modCfg.Dependencies, dep.String()) } sort.Strings(modCfg.Dependencies) return updateModuleConfig(ctx, engineClient, modFlagCfg, modCfg, cmd) }) }, } var moduleSyncCmd = &cobra.Command{ Use: "sync", Short: "Synchronize a dagger module with the latest version of its extensions", Hidden: false, RunE: func(cmd *cobra.Command, extraArgs []string) (rerr error) { ctx := cmd.Context() return withEngineAndTUI(ctx, client.Params{}, func(ctx context.Context, engineClient *client.Client) (err error) { modFlagCfg, _, err := getModuleFlagConfig(ctx, engineClient.Dagger()) if err != nil { return fmt.Errorf("failed to get module: %w", err) } if modFlagCfg.Git != nil { return fmt.Errorf("module sync is not supported for git modules") } modCfg, err := modFlagCfg.Config(ctx, engineClient.Dagger()) if err != nil { return fmt.Errorf("failed to get module config: %w", err) } return updateModuleConfig(ctx, engineClient, modFlagCfg, modCfg, cmd) }) }, } func updateModuleConfig(
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
ctx context.Context, engineClient *client.Client, modFlag *moduleFlagConfig, modCfg *modules.Config, cmd *cobra.Command, ) (rerr error) { rec := progrock.FromContext(ctx) if !modFlag.Local { return nil } moduleDir, err := modFlag.LocalSourcePath() if err != nil { return err } configPath := filepath.Join(moduleDir, modules.Filename) cfgBytes, err := json.MarshalIndent(modCfg, "", " ") if err != nil { return fmt.Errorf("failed to marshal module config: %w", err) } _, parentDirStatErr := os.Stat(moduleDir) switch { case parentDirStatErr == nil: case os.IsNotExist(parentDirStatErr):
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
if err := os.MkdirAll(moduleDir, 0o755); err != nil { return fmt.Errorf("failed to create module config directory: %w", err) } defer func() { if rerr != nil { os.RemoveAll(moduleDir) } }() default: return fmt.Errorf("failed to stat parent directory: %w", parentDirStatErr) } var cfgFileMode os.FileMode = 0o644 originalContents, configFileReadErr := os.ReadFile(configPath) switch { case configFileReadErr == nil: stat, err := os.Stat(configPath) if err != nil { return fmt.Errorf("failed to stat module config: %w", err) } cfgFileMode = stat.Mode() defer func() { if rerr != nil { os.WriteFile(configPath, originalContents, cfgFileMode) } }() case os.IsNotExist(configFileReadErr): defer func() { if rerr != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
os.Remove(configPath) } }() default: return fmt.Errorf("failed to read module config: %w", configFileReadErr) } if err := os.WriteFile(configPath, append(cfgBytes, '\n'), cfgFileMode); err != nil { return fmt.Errorf("failed to write module config: %w", err) } dag := engineClient.Dagger() mod, err := modFlag.AsModule(ctx, dag) if err != nil { return fmt.Errorf("failed to load module: %w", err) } codegen := mod.GeneratedCode() if err := automateVCS(ctx, moduleDir, codegen); err != nil { return fmt.Errorf("failed to automate vcs: %w", err) } entries, err := codegen.Code().Entries(ctx) if err != nil { return fmt.Errorf("failed to get codegen output entries: %w", err) } rec.Debug("syncing generated files", progrock.Labelf("entries", "%v", entries)) if _, err := codegen.Code().Export(ctx, moduleDir); err != nil { return fmt.Errorf("failed to export codegen output: %w", err) } return nil } func getModuleFlagConfig(ctx context.Context, dag *dagger.Client) (*moduleFlagConfig, bool, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
wasSet := false moduleURL := moduleURL if moduleURL == "" { if v, ok := os.LookupEnv("DAGGER_MODULE"); ok { moduleURL = v wasSet = true } if moduleURL == "" { moduleURL = moduleURLDefault } } else { wasSet = true } cfg, err := getModuleFlagConfigFromURL(ctx, dag, moduleURL) return cfg, wasSet, err } func getModuleFlagConfigFromURL(ctx context.Context, dag *dagger.Client, moduleURL string) (*moduleFlagConfig, error) { modRef, err := modules.ResolveMovingRef(ctx, dag, moduleURL) if err != nil { return nil, fmt.Errorf("failed to parse module URL: %w", err) } return &moduleFlagConfig{modRef}, nil } type moduleFlagConfig struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
*modules.Ref } func (p moduleFlagConfig) load(ctx context.Context, c *dagger.Client) (*dagger.Module, error) { mod, err := p.AsModule(ctx, c) if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
return nil, fmt.Errorf("failed to load module: %w", err) } return mod, nil } func (p moduleFlagConfig) modExists(ctx context.Context, c *dagger.Client) (bool, error) { switch { case p.Local: configPath := modules.NormalizeConfigPath(p.Path) _, err := os.Stat(configPath) if err == nil { return true, nil } if os.IsNotExist(err) { return false, nil } return false, fmt.Errorf("failed to stat module config: %w", err) case p.Git != nil: configPath := modules.NormalizeConfigPath(p.SubPath) _, err := c.Git(p.Git.CloneURL).Commit(p.Version).Tree().File(configPath).Sync(ctx) return err == nil, nil default: return false, fmt.Errorf("invalid module") } } func loadModCmdWrapper(
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
fn func(context.Context, *client.Client, *dagger.Module, *cobra.Command, []string) error, presetSecretToken string, ) func(*cobra.Command, []string) error { return func(cmd *cobra.Command, cmdArgs []string) error { return withEngineAndTUI(cmd.Context(), client.Params{ SecretToken: presetSecretToken, }, func(ctx context.Context, engineClient *client.Client) (err error) { rec := progrock.FromContext(ctx) vtx := rec.Vertex("cmd-loader", strings.Join(os.Args, " ")) defer func() { vtx.Done(err) }() load := vtx.Task("loading module") loadedMod, err := loadMod(ctx, engineClient.Dagger()) load.Done(err) if err != nil { return err } return fn(ctx, engineClient, loadedMod, cmd, cmdArgs) }) } } func loadMod(ctx context.Context, c *dagger.Client) (*dagger.Module, error) { mod, modRequired, err := getModuleFlagConfig(ctx, c) if err != nil { return nil, fmt.Errorf("failed to get module config: %w", err) } modExists, err := mod.modExists(ctx, c) if err != nil { return nil, fmt.Errorf("failed to check if module exists: %w", err) }
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
if !modExists && !modRequired { return nil, nil } loadedMod, err := mod.load(ctx, c) if err != nil { return nil, fmt.Errorf("failed to load module: %w", err) } _, err = loadedMod.Serve(ctx) if err != nil { return nil, fmt.Errorf("failed to get loaded module ID: %w", err) } return loadedMod, nil } func loadModObjects(ctx context.Context, dag *dagger.Client, mod *dagger.Module) (*moduleDef, error) { var res struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
Module *moduleDef } err := dag.Do(ctx, &dagger.Request{ Query: ` query Objects($module: ModuleID!) { module: loadModuleFromID(id: $module) { name objects { asObject { name functions { name description returnType { kind asObject { name } asList { elementTypeDef { kind asObject { name }
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
} } } args { name description defaultValue typeDef { kind optional asObject { name } asList { elementTypeDef { kind asObject { name } } } } } } fields { name description typeDef { kind optional
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
asObject { name } asList { elementTypeDef { kind asObject { name } } } } } } } } } `, Variables: map[string]interface{}{ "module": mod, }, }, &dagger.Response{ Data: &res, }) if err != nil { err = fmt.Errorf("query module objects: %w", err) } return res.Module, err } type moduleDef struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
Name string Objects []*modTypeDef } func (m *moduleDef) AsObjects() []*modObject { var defs []*modObject for _, typeDef := range m.Objects { if typeDef.AsObject != nil { defs = append(defs, typeDef.AsObject) } } return defs } func (m *moduleDef) GetObject(name string) *modObject { for _, obj := range m.AsObjects() { if gqlObjectName(obj.Name) == gqlObjectName(name) { return obj } } return nil } func (m *moduleDef) GetMainObject() *modObject { return m.GetObject(m.Name) } func (m *moduleDef) LoadObject(typeDef *modTypeDef) { if typeDef.AsObject != nil && typeDef.AsObject.Functions == nil && typeDef.AsObject.Fields == nil { obj := m.GetObject(typeDef.AsObject.Name) if obj != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
typeDef.AsObject = obj } } } type modTypeDef struct { Kind dagger.TypeDefKind Optional bool AsObject *modObject AsList *modList } type modObject struct { Name string Functions []*modFunction Fields []*modField } type modList struct { ElementTypeDef *modTypeDef } type modField struct { Name string Description string TypeDef *modTypeDef } type modFunction struct { Name string Description string ReturnType *modTypeDef Args []*modFunctionArg } type modFunctionArg struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
cmd/dagger/module.go
Name string Description string TypeDef *modTypeDef DefaultValue dagger.JSON flagName string } func (r *modFunctionArg) FlagName() string { if r.flagName == "" { r.flagName = cliName(r.Name) } return r.flagName } func getDefaultValue[T any](r *modFunctionArg) (T, error) { var val T err := json.Unmarshal([]byte(r.DefaultValue), &val) return val, err } func gqlObjectName(name string) string { return strcase.ToCamel(name) } func gqlFieldName(name string) string { return strcase.ToLowerCamel(name) } func gqlArgName(name string) string { return strcase.ToLowerCamel(name) } func cliName(name string) string { return strcase.ToKebab(name) }
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/module.go
package core import ( "encoding/json" "fmt" "path" "path/filepath" "strings" "github.com/dagger/dagger/core/modules" "github.com/dagger/dagger/core/pipeline" "github.com/dagger/dagger/core/resourceid" "github.com/dagger/dagger/engine/buildkit" "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/solver/pb" "github.com/opencontainers/go-digest" ocispecs "github.com/opencontainers/image-spec/specs-go/v1" "golang.org/x/sync/errgroup" ) const ( ModMetaDirPath = "/.daggermod" ModMetaInputPath = "input.json" ModMetaOutputPath = "output.json" ModMetaDepsDirPath = "deps" ) type Module struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/module.go
SourceDirectory *Directory `json:"sourceDirectory"` SourceDirectorySubpath string `json:"sourceDirectorySubpath"` Name string `json:"name"` Description string `json:"description"` Dependencies []*Module `json:"dependencies"` DependencyConfig []string `json:"dependencyConfig"` Objects []*TypeDef `json:"objects,omitempty"` SDK string `json:"sdk,omitempty"` Runtime *Container `json:"runtime,omitempty"`
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/module.go
Platform ocispecs.Platform `json:"platform,omitempty"` Pipeline pipeline.Path `json:"pipeline,omitempty"` } func (mod *Module) ID() (ModuleID, error) { return resourceid.Encode(mod) } func (mod *Module) Digest() (digest.Digest, error) { return stableDigest(mod) } func (mod *Module) DigestWithoutObjects() (digest.Digest, error) { mod = mod.Clone() mod.Objects = nil return stableDigest(mod) } func (mod *Module) PBDefinitions() ([]*pb.Definition, error) { var defs []*pb.Definition if mod.SourceDirectory != nil { dirDefs, err := mod.SourceDirectory.PBDefinitions() if err != nil { return nil, err } defs = append(defs, dirDefs...) } if mod.Runtime != nil { ctrDefs, err := mod.Runtime.PBDefinitions() if err != nil { return nil, err }
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/module.go
defs = append(defs, ctrDefs...) } for _, dep := range mod.Dependencies { depDefs, err := dep.PBDefinitions() if err != nil { return nil, err } defs = append(defs, depDefs...) } return defs, nil } func (mod Module) Clone() *Module { cp := mod if mod.SourceDirectory != nil { cp.SourceDirectory = mod.SourceDirectory.Clone() } if mod.Runtime != nil { cp.Runtime = mod.Runtime.Clone() } cp.Dependencies = make([]*Module, len(mod.Dependencies)) for i, dep := range mod.Dependencies { cp.Dependencies[i] = dep.Clone() } cp.Objects = make([]*TypeDef, len(mod.Objects)) for i, def := range mod.Objects { cp.Objects[i] = def.Clone() } return &cp } func NewModule(platform ocispecs.Platform, pipeline pipeline.Path) *Module {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/module.go
return &Module{ Platform: platform, Pipeline: pipeline, } } func LoadModuleConfigFromFile( ctx *Context, bk *buildkit.Client, svcs *Services, configFile *File, ) (*modules.Config, error) { configBytes, err := configFile.Contents(ctx, bk, svcs) if err != nil { return nil, fmt.Errorf("failed to read config file: %w", err) } var cfg modules.Config if err := json.Unmarshal(configBytes, &cfg); err != nil { return nil, fmt.Errorf("failed to unmarshal config: %w", err) } return &cfg, nil } func LoadModuleConfig(
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/module.go
ctx *Context, bk *buildkit.Client, svcs *Services, sourceDir *Directory, configPath string, ) (string, *modules.Config, error) { configPath = modules.NormalizeConfigPath(configPath) configFile, err := sourceDir.File(ctx, bk, svcs, configPath) if err != nil { return "", nil, fmt.Errorf("failed to get config file: %w", err) } cfg, err := LoadModuleConfigFromFile(ctx, bk, svcs, configFile) if err != nil { return "", nil, fmt.Errorf("failed to load config: %w", err) } return configPath, cfg, nil } type getRuntimeFunc func(ctx *Context, sourceDir *Directory, sourceDirSubpath string, sdkName string) (*Container, error) func (mod *Module) FromConfig( ctx *Context, bk *buildkit.Client, svcs *Services, progSock string, sourceDir *Directory, configPath string, getRuntime getRuntimeFunc, ) (*Module, error) { configPath, cfg, err := LoadModuleConfig(ctx, bk, svcs, sourceDir, configPath) if err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/module.go
} var eg errgroup.Group mod.Dependencies = make([]*Module, len(cfg.Dependencies)) for i, depURL := range cfg.Dependencies { i, depURL := i, depURL eg.Go(func() error { depMod, err := NewModule(mod.Platform, mod.Pipeline).FromRef(ctx, bk, svcs, progSock, sourceDir, configPath, depURL, getRuntime) if err != nil { return fmt.Errorf("failed to get dependency mod from ref %q: %w", depURL, err) } mod.Dependencies[i] = depMod return nil }) } if err := eg.Wait(); err != nil { return nil, err } if cfg.Root != "" { rootPath := filepath.Join("/", filepath.Dir(configPath), cfg.Root) if rootPath != "/" { var err error sourceDir, err = sourceDir.Directory(ctx, bk, svcs, rootPath) if err != nil { return nil, fmt.Errorf("failed to get root directory: %w", err) } configPath = filepath.Join("/", strings.TrimPrefix(configPath, rootPath)) } }
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/module.go
mod.SourceDirectory = sourceDir mod.SourceDirectorySubpath = filepath.Dir(configPath) mod.Name = cfg.Name mod.DependencyConfig = cfg.Dependencies mod.SDK = cfg.SDK mod.Runtime, err = getRuntime(ctx, mod.SourceDirectory, mod.SourceDirectorySubpath, mod.SDK) if err != nil { return nil, fmt.Errorf("failed to get runtime: %w", err) } return mod, nil } func (mod *Module) FromRef( ctx *Context, bk *buildkit.Client, svcs *Services, progSock string, parentSrcDir *Directory, parentSrcSubpath string, moduleRefStr string, getRuntime getRuntimeFunc, ) (*Module, error) { modRef, err := modules.ResolveStableRef(moduleRefStr) if err != nil { return nil, fmt.Errorf("failed to parse dependency url %q: %w", moduleRefStr, err) }
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/module.go
var sourceDir *Directory var configPath string switch { case modRef.Local: if parentSrcDir == nil { return nil, fmt.Errorf("invalid local module ref is local relative to nil parent %q", moduleRefStr) } sourceDir = parentSrcDir configPath = modules.NormalizeConfigPath(path.Join("/", path.Dir(parentSrcSubpath), modRef.Path)) case modRef.Git != nil: var err error sourceDir, err = NewDirectorySt(ctx, llb.Git(modRef.Git.CloneURL, modRef.Version), "", mod.Pipeline, mod.Platform, nil) if err != nil { return nil, fmt.Errorf("failed to create git directory: %w", err) } configPath = modules.NormalizeConfigPath(modRef.SubPath) default: return nil, fmt.Errorf("invalid module ref %q", moduleRefStr) } return mod.FromConfig(ctx, bk, svcs, progSock, sourceDir, configPath, getRuntime) } func (mod *Module) WithObject(def *TypeDef) (*Module, error) { mod = mod.Clone() if def.AsObject == nil { return nil, fmt.Errorf("expected object type def, got %s: %+v", def.Kind, def) } mod.Objects = append(mod.Objects, def) return mod, nil }
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/modules/resolver.go
package modules import ( "bufio" "bytes" "context" "encoding/json" "fmt" "os" "path" "path/filepath" "strings" "dagger.io/dagger" ) type Ref struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/modules/resolver.go
Path string Version string Local bool Git *GitRef SubPath string } type GitRef struct { HTMLURL string CloneURL string Commit string } func (ref *Ref) String() string { if ref.Local { p, err := ref.LocalSourcePath() if err != nil { panic(err) } return p } if ref.Version == "" { return ref.Path } return fmt.Sprintf("%s@%s", ref.Path, ref.Version) } func (ref *Ref) Symbolic() string { var root string switch { case ref.Local: root = ref.Path
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/modules/resolver.go
case ref.Git != nil: root = ref.Git.CloneURL default: panic("invalid module ref") } return path.Join(root, ref.SubPath) } func (ref *Ref) LocalSourcePath() (string, error) { if ref.Local { return path.Join(ref.Path, ref.SubPath), nil } return "", fmt.Errorf("cannot get local source path for non-local module") } func (ref *Ref) Config(ctx context.Context, c *dagger.Client) (*Config, error) { switch { case ref.Local: configBytes, err := os.ReadFile(path.Join(ref.Path, Filename)) if err != nil { return nil, fmt.Errorf("failed to read local config file: %w", err) } var cfg Config if err := json.Unmarshal(configBytes, &cfg); err != nil { return nil, fmt.Errorf("failed to parse local config file: %w", err) }
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/modules/resolver.go
return &cfg, nil case ref.Git != nil: if c == nil { return nil, fmt.Errorf("cannot load git module config with nil dagger client") } repoDir := c.Git(ref.Git.CloneURL).Commit(ref.Version).Tree() var configPath string if ref.SubPath != "" { configPath = path.Join(ref.SubPath, Filename) } else { configPath = Filename } configStr, err := repoDir.File(configPath).Contents(ctx) if err != nil { return nil, fmt.Errorf("failed to read git config file: %w", err) } var cfg Config if err := json.Unmarshal([]byte(configStr), &cfg); err != nil { return nil, fmt.Errorf("failed to parse git config file: %w", err) } return &cfg, nil default: panic("invalid module ref") } } func (ref *Ref) AsModule(ctx context.Context, c *dagger.Client) (*dagger.Module, error) { cfg, err := ref.Config(ctx, c) if err != nil { return nil, fmt.Errorf("failed to get module config: %w", err) }
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/modules/resolver.go
switch { case ref.Local: localSrc, err := ref.LocalSourcePath() if err != nil { panic(err) } modRootDir, subdirRelPath, err := cfg.RootAndSubpath(localSrc) if err != nil { return nil, fmt.Errorf("failed to get module root: %w", err) } return c.Host().Directory(modRootDir, dagger.HostDirectoryOpts{ Include: cfg.Include, Exclude: cfg.Exclude, }).AsModule(dagger.DirectoryAsModuleOpts{ SourceSubpath: subdirRelPath, }), nil case ref.Git != nil: rootPath := path.Clean(path.Join(ref.SubPath, cfg.Root)) if strings.HasPrefix(rootPath, "..") { return nil, fmt.Errorf("module config path %q is not under module root %q", ref.SubPath, rootPath) } return c.Git(ref.Git.CloneURL).Commit(ref.Version).Tree(). Directory(rootPath). AsModule(), nil default: return nil, fmt.Errorf("invalid module (local=%t, git=%t)", ref.Local, ref.Git != nil) } } func ResolveStableRef(modQuery string) (*Ref, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/modules/resolver.go
modPath, modVersion, hasVersion := strings.Cut(modQuery, "@") ref := &Ref{ Path: modPath, } isGitHub := strings.HasPrefix(modPath, "github.com/") if !hasVersion { if isGitHub { return nil, fmt.Errorf("no version provided for remote ref: %s", modQuery) }
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/modules/resolver.go
ref.Local = true return ref, nil } ref.Git = &GitRef{} if !isGitHub { return nil, fmt.Errorf("for now, only github.com/ paths are supported: %s", modPath) } segments := strings.SplitN(modPath, "/", 4) if len(segments) < 3 { return nil, fmt.Errorf("invalid github.com path: %s", modPath) } ref.Git.CloneURL = "https:" + segments[0] + "/" + segments[1] + "/" + segments[2] if !hasVersion { return nil, fmt.Errorf("no version provided for %s", modPath) } ref.Version = modVersion ref.Git.Commit = modVersion if len(segments) == 4 { ref.SubPath = segments[3] ref.Git.HTMLURL = "https:" + segments[0] + "/" + segments[1] + "/" + segments[2] + "/tree/" + ref.Version + "/" + ref.SubPath } else { ref.Git.HTMLURL = "https:" + segments[0] + "/" + segments[1] + "/" + segments[2] } return ref, nil } func ResolveMovingRef(ctx context.Context, dag *dagger.Client, modQuery string) (*Ref, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/modules/resolver.go
modPath, modVersion, hasVersion := strings.Cut(modQuery, "@") ref := &Ref{ Path: modPath, } isGitHub := strings.HasPrefix(modPath, "github.com/") if !hasVersion && !isGitHub { ref.Local = true return ref, nil } ref.Git = &GitRef{}
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/modules/resolver.go
if !isGitHub { return nil, fmt.Errorf("for now, only github.com/ paths are supported: %q", modQuery) } segments := strings.SplitN(modPath, "/", 4) if len(segments) < 3 { return nil, fmt.Errorf("invalid github.com path: %s", modPath) } ref.Git.CloneURL = "https:" + segments[0] + "/" + segments[1] + "/" + segments[2] if !hasVersion { var err error modVersion, err = defaultBranch(ctx, dag, ref.Git.CloneURL) if err != nil { return nil, fmt.Errorf("determine default branch: %w", err) } } gitCommit, err := resolveGitRef(ctx, dag, ref.Git.CloneURL, modVersion) if err != nil { return nil, fmt.Errorf("resolve git ref: %w", err) } ref.Version = gitCommit ref.Git.Commit = gitCommit if len(segments) == 4 { ref.SubPath = segments[3] ref.Git.HTMLURL = "https:" + segments[0] + "/" + segments[1] + "/" + segments[2] + "/tree/" + ref.Version + "/" + ref.SubPath } else { ref.Git.HTMLURL = "https:" + segments[0] + "/" + segments[1] + "/" + segments[2] } return ref, nil } func ResolveModuleDependency(ctx context.Context, dag *dagger.Client, parent *Ref, urlStr string) (*Ref, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/modules/resolver.go
mod, err := ResolveMovingRef(ctx, dag, urlStr) if err != nil { return nil, fmt.Errorf("failed to resolve module: %w", err) } if mod.Local { cp := *parent if cp.SubPath != "" { cp.SubPath = filepath.Join(cp.SubPath, mod.Path) } else { cp.SubPath = mod.Path } return &cp, nil } return mod, nil } func defaultBranch(ctx context.Context, dag *dagger.Client, repo string) (string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/modules/resolver.go
output, err := dag.Container(). From("alpine/git"). WithExec([]string{"git", "ls-remote", "--symref", repo, "HEAD"}, dagger.ContainerWithExecOpts{ SkipEntrypoint: true, }). Stdout(ctx) if err != nil { return "", err } scanner := bufio.NewScanner(bytes.NewBufferString(output)) for scanner.Scan() { fields := strings.Fields(scanner.Text()) if len(fields) < 3 { continue } if fields[0] == "ref:" && fields[2] == "HEAD" { return strings.TrimPrefix(fields[1], "refs/heads/"), nil } } return "", fmt.Errorf("could not deduce default branch from output:\n%s", output) } func resolveGitRef(ctx context.Context, dag *dagger.Client, repo, ref string) (string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,953
🐞 `dagger call -m <git-module>` fails if remote module contains dependencies with local path
### What is the issue? When we call a module with local dependency using `git-ref`, cli isn't able to find dependencies. `dagger.json` for following error log https://github.com/aweris/gale/blob/0fcf43c126b03fc4296f05970328aaca085c18af/daggerverse/gale/dagger.json#L1-L9 ### Log output ```shell dagger call --mod github.com/aweris/gale/daggerverse/gale@0fcf43c126b03fc4296f05970328aaca085c18af ✘ build "dagger call" ERROR [4.15s] ├ [4.15s] loading module ✘ asModule ERROR [0.00s] • Engine: 61b34bf9d33e (version v0.9.0) ⧗ 5.44s ✔ 27 ✘ 2 Error: failed to get loaded module ID: input:1: git.commit.tree.directory.asModule failed to create module from config `.::`: failed to get config file: lstat dagger.json: no such file or directory ``` ### Steps to reproduce - create a module with has a dependency on the local path. - push module to repository - make a `dagger call -m <git-ref>` ### SDK version Dagger CLI v0.9.0 ### OS version macOS 14.0
https://github.com/dagger/dagger/issues/5953
https://github.com/dagger/dagger/pull/5955
0b52104f252de11914914520948bf83c94d2068c
51baf38f1c59be4d4935a2d2ca5af4b642f21a2e
2023-10-23T16:39:21Z
go
2023-10-24T16:05:15Z
core/modules/resolver.go
repoDir := dag.Git(repo, dagger.GitOpts{KeepGitDir: true}).Commit(ref).Tree() output, err := dag.Container(). From("alpine/git"). WithMountedDirectory("/repo", repoDir). WithWorkdir("/repo"). WithExec([]string{"git", "rev-parse", "HEAD"}, dagger.ContainerWithExecOpts{ SkipEntrypoint: true, }). Stdout(ctx) if err != nil { return "", err } return strings.TrimSpace(output), nil }
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
package templates import ( "encoding/json" "fmt" "go/ast" "go/token" "go/types" "path/filepath" "sort" "strings" . "github.com/dave/jennifer/jen" "github.com/fatih/structtag" "github.com/iancoleman/strcase" "golang.org/x/tools/go/packages" ) const daggerGenFilename = "dagger.gen.go" /* TODO: * Handle types from 3rd party imports in the type signature * Add packages.NeedImports and packages.NeedDependencies to packages.Load opts, ensure performance is okay (or deal with that by lazy loading) * Fix problem where changing a function signature requires running `dagger mod sync` twice (first one will result in package errors being seen, second one fixes) * Use Overlays field in packages.Config to provide partial generation of dagger.gen.go, without the unupdated code we generate here * Handle automatically re-running `dagger mod sync` when invoking functions from CLI, to save users from having to always remember while developing locally * Support methods defined on non-pointer receivers */ /* moduleMainSrc generates the source code of the main func for Dagger Module code using the Go SDK. The overall idea is that users just need to create a struct with the same name as their Module and then
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
add methods to that struct to implement their Module. Methods on that struct become Functions. They are also free to return custom objects from Functions, which themselves may have methods that become Functions too. However, only the "top-level" Module struct's Functions will be directly invokable. This is essentially just the GraphQL execution model. The implementation works by parsing the user's code and generating a main func that reads function call inputs from the Engine, calls the relevant function and returns the result. The generated code is mostly a giant switch/case on the object+function name, with each case doing json deserialization of the input arguments and calling the actual Go function. */ func (funcs goTemplateFuncs) moduleMainSrc() string { if funcs.modulePkg == nil { return `func main() { panic("no code yet") }` } ps := &parseState{ pkg: funcs.modulePkg, fset: funcs.moduleFset, methods: make(map[string][]method), } pkgScope := funcs.modulePkg.Types.Scope() objFunctionCases := map[string][]Code{} createMod := Qual("dag", "CurrentModule").Call() objs := []types.Object{} for _, name := range pkgScope.Names() { obj := pkgScope.Lookup(name) if obj == nil { continue } objs = append(objs, obj)
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
} sort.Slice(objs, func(i, j int) bool { return objs[i].Pos() < objs[j].Pos() }) tps := []types.Type{} for _, obj := range objs { tps = append(tps, obj.Type()) } added := map[string]struct{}{} topLevel := true for len(tps) != 0 { for _, tp := range tps { named, isNamed := tp.(*types.Named) if !isNamed { continue } obj := named.Obj() if obj.Pkg() != funcs.modulePkg.Types { continue } strct, isStruct := named.Underlying().(*types.Struct) if !isStruct { continue } if _, ok := added[obj.Name()]; ok { continue
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
} objType, err := ps.goStructToAPIType(strct, named) if err != nil { panic(err) } if objType == nil { continue } if err := ps.fillObjectFunctionCases(named, objFunctionCases); err != nil { panic(err) } if len(objFunctionCases[obj.Name()]) == 0 { if topLevel { continue } tokenFile := ps.fset.File(named.Obj().Pos()) isDaggerGenerated := filepath.Base(tokenFile.Name()) == daggerGenFilename if isDaggerGenerated { continue } } createMod = dotLine(createMod, "WithObject").Call(Add(Line(), objType)) added[obj.Name()] = struct{}{}
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
} tps, ps.extraTypes = ps.extraTypes, nil topLevel = false } return strings.Join([]string{mainSrc, invokeSrc(objFunctionCases, createMod)}, "\n") } func dotLine(a *Statement, id string) *Statement { return a.Op(".").Line().Id(id) } const ( mainSrc = `func main() {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
ctx := context.Background() fnCall := dag.CurrentFunctionCall() parentName, err := fnCall.ParentName(ctx) if err != nil { fmt.Println(err.Error()) os.Exit(2) } fnName, err := fnCall.Name(ctx) if err != nil { fmt.Println(err.Error()) os.Exit(2) } parentJson, err := fnCall.Parent(ctx) if err != nil { fmt.Println(err.Error()) os.Exit(2) } fnArgs, err := fnCall.InputArgs(ctx) if err != nil { fmt.Println(err.Error()) os.Exit(2) } inputArgs := map[string][]byte{} for _, fnArg := range fnArgs { argName, err := fnArg.Name(ctx) if err != nil { fmt.Println(err.Error()) os.Exit(2) } argValue, err := fnArg.Value(ctx)
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
if err != nil { fmt.Println(err.Error()) os.Exit(2) } inputArgs[argName] = []byte(argValue) } result, err := invoke(ctx, []byte(parentJson), parentName, fnName, inputArgs) if err != nil { fmt.Println(err.Error()) os.Exit(2) } resultBytes, err := json.Marshal(result) if err != nil { fmt.Println(err.Error()) os.Exit(2) } _, err = fnCall.ReturnValue(ctx, JSON(resultBytes)) if err != nil { fmt.Println(err.Error()) os.Exit(2) } } ` parentJSONVar = "parentJSON" parentNameVar = "parentName" fnNameVar = "fnName" inputArgsVar = "inputArgs" invokeFuncName = "invoke" ) func invokeSrc(objFunctionCases map[string][]Code, createMod Code) string {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
objCases := []Code{} for objName, functionCases := range objFunctionCases { objCases = append(objCases, Case(Lit(objName)).Block(Switch(Id(fnNameVar)).Block(functionCases...))) } objCases = append(objCases, Case(Lit("")).Block( Return(createMod, Nil()), )) objCases = append(objCases, Default().Block( Return(Nil(), Qual("fmt", "Errorf").Call(Lit("unknown object %s"), Id(parentNameVar))), )) objSwitch := Switch(Id(parentNameVar)).Block(objCases...) invokeFunc := Func().Id(invokeFuncName).Params( Id("ctx").Qual("context", "Context"), Id(parentJSONVar).Index().Byte(), Id(parentNameVar).String(), Id(fnNameVar).String(), Id(inputArgsVar).Map(String()).Index().Byte(), ).Params(
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
Id("any"), Error(), ).Block(objSwitch) return fmt.Sprintf("%#v", invokeFunc) } func renderNameOrStruct(t types.Type) string { if ptr, ok := t.(*types.Pointer); ok { return "*" + renderNameOrStruct(ptr.Elem()) } if named, ok := t.(*types.Named); ok { return named.Obj().Name() } return t.String() } var checkErrStatement = If(Err().Op("!=").Nil()).Block( Qual("fmt", "Println").Call(Err().Dot("Error").Call()), Qual("os", "Exit").Call(Lit(2)), ) func (ps *parseState) fillObjectFunctionCases(type_ types.Type, cases map[string][]Code) error { var objName string switch x := type_.(type) { case *types.Pointer: return ps.fillObjectFunctionCases(x.Elem(), cases) case *types.Named:
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
objName = x.Obj().Name() default: return nil } if existingCases := cases[objName]; len(existingCases) > 0 { return nil } methods := ps.methods[objName] if len(methods) == 0 { return nil } for _, method := range methods { fnName, sig := method.name, method.sig statements := []Code{ Var().Id("err").Error(), } parentVarName := "parent" statements = append(statements, Var().Id(parentVarName).Id(objName), Err().Op("=").Qual("json", "Unmarshal").Call(Id(parentJSONVar), Op("&").Id(parentVarName)), checkErrStatement, ) fnCallArgs := []Code{Op("&").Id(parentVarName)} for i := 0; i < sig.Params().Len(); i++ { arg := sig.Params().At(i) if i == 0 && arg.Type().String() == "context.Context" { fnCallArgs = append(fnCallArgs, Id("ctx")) continue }
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
if opts, ok := namedOrDirectStruct(arg.Type()); ok { optsName := arg.Name() statements = append(statements, Var().Id(optsName).Id(renderNameOrStruct(arg.Type()))) for f := 0; f < opts.NumFields(); f++ { param := opts.Field(f) argName := strcase.ToLowerCamel(param.Name()) statements = append(statements, If(Id(inputArgsVar).Index(Lit(argName)).Op("!=").Nil()).Block( Err().Op("=").Qual("json", "Unmarshal").Call( Index().Byte().Parens(Id(inputArgsVar).Index(Lit(argName))), Op("&").Id(optsName).Dot(param.Name()), ), checkErrStatement, )) } fnCallArgs = append(fnCallArgs, Id(optsName)) } else { argName := strcase.ToLowerCamel(arg.Name()) statements = append(statements, Var().Id(argName).Id(renderNameOrStruct(arg.Type())), Err().Op("=").Qual("json", "Unmarshal").Call( Index().Byte().Parens(Id(inputArgsVar).Index(Lit(argName))), Op("&").Id(argName), ), checkErrStatement, ) fnCallArgs = append(fnCallArgs, Id(argName)) } }
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
results := sig.Results() switch results.Len() { case 2: if results.At(1).Type().String() != errorTypeName { return fmt.Errorf("second return value must be error, have %s", results.At(0).Type().String()) } statements = append(statements, Return( Parens(Op("*").Id(objName)).Dot(fnName).Call(fnCallArgs...), )) cases[objName] = append(cases[objName], Case(Lit(fnName)).Block(statements...)) if err := ps.fillObjectFunctionCases(results.At(0).Type(), cases); err != nil { return err } case 1: if results.At(0).Type().String() == errorTypeName { statements = append(statements, Return( Nil(), Parens(Op("*").Id(objName)).Dot(fnName).Call(fnCallArgs...), )) cases[objName] = append(cases[objName], Case(Lit(fnName)).Block(statements...)) } else { statements = append(statements, Return( Parens(Op("*").Id(objName)).Dot(fnName).Call(fnCallArgs...), Nil(), )) cases[objName] = append(cases[objName], Case(Lit(fnName)).Block(statements...))
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
if err := ps.fillObjectFunctionCases(results.At(0).Type(), cases); err != nil { return err } } case 0: statements = append(statements, Parens(Op("*").Id(objName)).Dot(fnName).Call(fnCallArgs...), Return(Nil(), Nil())) cases[objName] = append(cases[objName], Case(Lit(fnName)).Block(statements...)) default: return fmt.Errorf("unexpected number of results from method %s: %d", fnName, results.Len()) } } cases[objName] = append(cases[objName], Default().Block( Return(Nil(), Qual("fmt", "Errorf").Call(Lit("unknown function %s"), Id(fnNameVar))), )) return nil } type parseState struct { pkg *packages.Package fset *token.FileSet methods map[string][]method extraTypes []types.Type } type method struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
name string sig *types.Signature } func (ps *parseState) goTypeToAPIType(typ types.Type, named *types.Named) (*Statement, error) { ps.extraTypes = append(ps.extraTypes, typ) switch t := typ.(type) { case *types.Named: typeDef, err := ps.goTypeToAPIType(t.Underlying(), t) if err != nil { return nil, fmt.Errorf("failed to convert named type: %w", err) } return typeDef, nil case *types.Pointer: return ps.goTypeToAPIType(t.Elem(), named) case *types.Basic: if t.Kind() == types.Invalid { return nil, fmt.Errorf("invalid type: %+v", t) } var kind Code switch t.Info() { case types.IsString: kind = Id("Stringkind") case types.IsInteger: kind = Id("Integerkind") case types.IsBoolean: kind = Id("Booleankind")
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
default: return nil, fmt.Errorf("unsupported basic type: %+v", t) } return Qual("dag", "TypeDef").Call().Dot("WithKind").Call( kind, ), nil case *types.Slice: elemTypeDef, err := ps.goTypeToAPIType(t.Elem(), nil) if err != nil { return nil, fmt.Errorf("failed to convert slice element type: %w", err) } return Qual("dag", "TypeDef").Call().Dot("WithListOf").Call( elemTypeDef, ), nil case *types.Struct: if named == nil { return nil, fmt.Errorf("struct types must be named") } typeName := named.Obj().Name() if typeName == "" { return nil, fmt.Errorf("struct types must be named") } return Qual("dag", "TypeDef").Call().Dot("WithObject").Call( Lit(typeName), ), nil default: return nil, fmt.Errorf("unsupported type %T", t) } } const errorTypeName = "error"
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
func (ps *parseState) goStructToAPIType(t *types.Struct, named *types.Named) (*Statement, error) { if named == nil { return nil, fmt.Errorf("struct types must be named") } typeName := named.Obj().Name() if typeName == "" { return nil, fmt.Errorf("struct types must be named") } tokenFile := ps.fset.File(named.Obj().Pos()) objectIsDaggerGenerated := filepath.Base(tokenFile.Name()) == daggerGenFilename methods := []*types.Func{} methodSet := types.NewMethodSet(types.NewPointer(named)) for i := 0; i < methodSet.Len(); i++ { methodObj := methodSet.At(i).Obj() methodTokenFile := ps.fset.File(methodObj.Pos()) methodIsDaggerGenerated := filepath.Base(methodTokenFile.Name()) == daggerGenFilename if methodIsDaggerGenerated { continue } if objectIsDaggerGenerated { return nil, fmt.Errorf("cannot define methods on objects from outside this module") } method, ok := methodObj.(*types.Func) if !ok {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
return nil, fmt.Errorf("expected method to be a func, got %T", methodObj) } if !method.Exported() { continue } methods = append(methods, method) } if objectIsDaggerGenerated { return nil, nil } sort.Slice(methods, func(i, j int) bool { return methods[i].Pos() < methods[j].Pos() }) withObjectArgs := []Code{ Lit(typeName), } withObjectOpts := []Code{} typeSpec, err := ps.typeSpecForNamedType(named) if err != nil { return nil, fmt.Errorf("failed to find decl for named type %s: %w", typeName, err) } if doc := typeSpec.Doc; doc != nil { withObjectOpts = append(withObjectOpts, Id("Description").Op(":").Lit(doc.Text())) } if len(withObjectOpts) > 0 { withObjectArgs = append(withObjectArgs, Id("TypeDefWithObjectOpts").Values(withObjectOpts...)) } typeDef := Qual("dag", "TypeDef").Call().Dot("WithObject").Call(withObjectArgs...)
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
for _, method := range methods { fnTypeDef, err := ps.goMethodToAPIFunctionDef(typeName, method, named) if err != nil { return nil, fmt.Errorf("failed to convert method %s to function def: %w", method.Name(), err) } typeDef = dotLine(typeDef, "WithFunction").Call(Add(Line(), fnTypeDef)) } astStructType, ok := typeSpec.Type.(*ast.StructType) if !ok { return nil, fmt.Errorf("expected type spec to be a struct, got %T", typeSpec.Type) } for i := 0; i < t.NumFields(); i++ { field := t.Field(i) if !field.Exported() { continue } fieldTypeDef, err := ps.goTypeToAPIType(field.Type(), nil) if err != nil { return nil, fmt.Errorf("failed to convert field type: %w", err) } var description string if doc := astStructType.Fields.List[i].Doc; doc != nil { description = doc.Text() } withFieldArgs := []Code{ Lit(field.Name()), fieldTypeDef, } if description != "" {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
withFieldArgs = append(withFieldArgs, Id("TypeDefWithFieldOpts").Values( Id("Description").Op(":").Lit(description), )) } typeDef = dotLine(typeDef, "WithField").Call(withFieldArgs...) } return typeDef, nil } var voidDef = Qual("dag", "TypeDef").Call(). Dot("WithKind").Call(Id("Voidkind")). Dot("WithOptional").Call(Lit(true)) func (ps *parseState) goMethodToAPIFunctionDef(typeName string, fn *types.Func, named *types.Named) (*Statement, error) { methodSig, ok := fn.Type().(*types.Signature) if !ok { return nil, fmt.Errorf("expected method to be a func, got %T", fn.Type()) } ps.methods[typeName] = append(ps.methods[typeName], method{ name: fn.Name(), sig: methodSig, }) var err error var fnReturnType *Statement methodResults := methodSig.Results() switch methodResults.Len() { case 0: fnReturnType = voidDef case 1:
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
result := methodResults.At(0).Type() if result.String() == errorTypeName { fnReturnType = voidDef } else { fnReturnType, err = ps.goTypeToAPIType(result, nil) if err != nil { return nil, fmt.Errorf("failed to convert result type: %w", err) } } case 2: result := methodResults.At(0).Type() fnReturnType, err = ps.goTypeToAPIType(result, nil) if err != nil { return nil, fmt.Errorf("failed to convert result type: %w", err) } default: return nil, fmt.Errorf("method %s has too many return values", fn.Name()) } fnDef := Qual("dag", "Function").Call(Lit(fn.Name()), Add(Line(), fnReturnType)) funcDecl, err := ps.declForFunc(fn) if err != nil { return nil, fmt.Errorf("failed to find decl for method %s: %w", fn.Name(), err) } if doc := funcDecl.Doc; doc != nil { fnDef = dotLine(fnDef, "WithDescription").Call(Lit(doc.Text())) } for i := 0; i < methodSig.Params().Len(); i++ { param := methodSig.Params().At(i) if i == 0 && param.Type().String() == "context.Context" {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
continue } if opts, ok := namedOrDirectStruct(param.Type()); ok { for f := 0; f < opts.NumFields(); f++ { param := opts.Field(f) tags, err := structtag.Parse(opts.Tag(f)) if err != nil { return nil, fmt.Errorf("failed to parse struct tag: %w", err) } argTypeDef, err := ps.goTypeToAPIType(param.Type(), nil) if err != nil { return nil, fmt.Errorf("failed to convert param type: %w", err) } argOptional := true if tags != nil { if tag, err := tags.Get("required"); err == nil { argOptional = tag.Value() == "true" } } argTypeDef = argTypeDef.Dot("WithOptional").Call(Lit(argOptional)) argArgs := []Code{ Lit(param.Name()), argTypeDef, } argOpts := []Code{} if tags != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
if tag, err := tags.Get("doc"); err == nil { argOpts = append(argOpts, Id("Description").Op(":").Lit(tag.Value())) } if tag, err := tags.Get("default"); err == nil { var jsonEnc string if param.Type().String() == "string" { enc, err := json.Marshal(tag.Value()) if err != nil { return nil, fmt.Errorf("failed to marshal default value: %w", err) } jsonEnc = string(enc) } else { jsonEnc = tag.Value() } argOpts = append(argOpts, Id("DefaultValue").Op(":").Id("JSON").Call(Lit(jsonEnc))) } } if len(argOpts) > 0 { argArgs = append(argArgs, Id("FunctionWithArgOpts").Values(argOpts...)) } fnDef = dotLine(fnDef, "WithArg").Call(argArgs...) } } else { argTypeDef, err := ps.goTypeToAPIType(param.Type(), nil) if err != nil { return nil, fmt.Errorf("failed to convert param type: %w", err) } fnDef = dotLine(fnDef, "WithArg").Call(Lit(param.Name()), argTypeDef)
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
} } return fnDef, nil } func namedOrDirectStruct(t types.Type) (*types.Struct, bool) { switch x := t.(type) { case *types.Named: return namedOrDirectStruct(x.Underlying()) case *types.Struct: return x, true default: return nil, false } } func (ps *parseState) typeSpecForNamedType(namedType *types.Named) (*ast.TypeSpec, error) { tokenFile := ps.fset.File(namedType.Obj().Pos()) if tokenFile == nil { return nil, fmt.Errorf("no file for %s", namedType.Obj().Name()) } for _, f := range ps.pkg.Syntax { if ps.fset.File(f.Pos()) != tokenFile { continue } for _, decl := range f.Decls { genDecl, ok := decl.(*ast.GenDecl) if !ok { continue } for _, spec := range genDecl.Specs { typeSpec, ok := spec.(*ast.TypeSpec)
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
cmd/codegen/generator/go/templates/modules.go
if !ok { continue } if typeSpec.Name.Name == namedType.Obj().Name() { return typeSpec, nil } } } } return nil, fmt.Errorf("no decl for %s", namedType.Obj().Name()) } func (ps *parseState) declForFunc(fnType *types.Func) (*ast.FuncDecl, error) { tokenFile := ps.fset.File(fnType.Pos()) if tokenFile == nil { return nil, fmt.Errorf("no file for %s", fnType.Name()) } for _, f := range ps.pkg.Syntax { if ps.fset.File(f.Pos()) != tokenFile { continue } for _, decl := range f.Decls { fnDecl, ok := decl.(*ast.FuncDecl) if ok && fnDecl.Name.Name == fnType.Name() { return fnDecl, nil } } } return nil, fmt.Errorf("no decl for %s", fnType.Name()) }
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
package core import ( "context" _ "embed" "errors" "fmt" "os" "path/filepath" "strconv" "strings" "testing" "time" "dagger.io/dagger" "github.com/iancoleman/strcase" "github.com/moby/buildkit/identity" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" ) /* TODO: add coverage for * dagger mod use * dagger mod sync * that the codegen of the testdata envs are up to date (or incorporate that into a cli command) * if a dependency changes, then checks should re-run */ func TestModuleGoInit(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
t.Run("from scratch", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=bare", "--sdk=go")) logGen(ctx, t, modGen.Directory(".")) out, err := modGen. With(daggerQuery(`{bare{myFunction(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"bare":{"myFunction":{"stdout":"hello\n"}}}`, out) }) t.Run("kebab-cases Go module name, camel-cases Dagger module name", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=My-Module", "--sdk=go")) logGen(ctx, t, modGen.Directory(".")) out, err := modGen. With(daggerQuery(`{myModule{myFunction(stringArg:"hello"){stdout}}}`)). Stdout(ctx)
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
require.NoError(t, err) require.JSONEq(t, `{"myModule":{"myFunction":{"stdout":"hello\n"}}}`, out) generated, err := modGen.File("go.mod").Contents(ctx) require.NoError(t, err) require.Contains(t, generated, "module my-module") }) t.Run("creates go.mod beneath an existing go.mod if root points beneath it", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("/work/go.mod", dagger.ContainerWithNewFileOpts{ Contents: "module example.com/test\n", }). WithNewFile("/work/foo.go", dagger.ContainerWithNewFileOpts{ Contents: "package foo\n", }). WithWorkdir("/work/ci"). With(daggerExec("mod", "init", "--name=beneathGoMod", "--sdk=go")) logGen(ctx, t, modGen.Directory(".")) out, err := modGen. With(daggerQuery(`{beneathGoMod{myFunction(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"beneathGoMod":{"myFunction":{"stdout":"hello\n"}}}`, out) t.Run("names Go module after Dagger module", func(t *testing.T) { generated, err := modGen.File("go.mod").Contents(ctx) require.NoError(t, err) require.Contains(t, generated, "module beneath-go-mod")
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
}) }) t.Run("respects existing go.mod", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithExec([]string{"go", "mod", "init", "example.com/test"}). With(daggerExec("mod", "init", "--name=hasGoMod", "--sdk=go")) logGen(ctx, t, modGen.Directory(".")) out, err := modGen. With(daggerQuery(`{hasGoMod{myFunction(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"hasGoMod":{"myFunction":{"stdout":"hello\n"}}}`, out) t.Run("preserves module name", func(t *testing.T) { generated, err := modGen.File("go.mod").Contents(ctx) require.NoError(t, err) require.Contains(t, generated, "module example.com/test") }) }) t.Run("respects parent go.mod if root points to it", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithExec([]string{"go", "mod", "init", "example.com/test"}). WithNewFile("/work/foo.go", dagger.ContainerWithNewFileOpts{
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
Contents: "package foo\n", }). WithWorkdir("/work/child"). With(daggerExec("mod", "init", "--name=child", "--sdk=go", "--root=..")). WithNewFile("/work/child/main.go", dagger.ContainerWithNewFileOpts{ Contents: ` package main import "os" type Child struct{} func (m *Child) Root() *Directory { wd, err := os.Getwd() if err != nil { panic(err) } return dag.Host().Directory(wd+"/..") } `, }) generated := modGen. With(daggerExec("mod", "sync")). Directory(".") logGen(ctx, t, generated) out, err := modGen. With(daggerQuery(`{child{root{entries}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"child":{"root":{"entries":["child","foo.go","go.mod","go.sum"]}}}`, out) childEntries, err := generated.Entries(ctx) require.NoError(t, err)
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
require.NotContains(t, childEntries, "go.mod") t.Run("preserves parent module name", func(t *testing.T) { generated, err := modGen.File("/work/go.mod").Contents(ctx) require.NoError(t, err) require.Contains(t, generated, "module example.com/test") }) }) t.Run("respects existing go.mod even if root points to parent that has go.mod", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithExec([]string{"go", "mod", "init", "example.com/test"}). WithNewFile("/work/foo.go", dagger.ContainerWithNewFileOpts{ Contents: "package foo\n", }). WithWorkdir("/work/child"). WithExec([]string{"go", "mod", "init", "my-mod"}). With(daggerExec("mod", "init", "--name=child", "--sdk=go", "--root=..")). WithNewFile("/work/child/main.go", dagger.ContainerWithNewFileOpts{ Contents: ` package main import "os" type Child struct{} func (m *Child) Root() *Directory { wd, err := os.Getwd() if err != nil { panic(err) }
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
return dag.Host().Directory(wd+"/..") } `, }) generated := modGen. With(daggerExec("mod", "sync")). Directory(".") logGen(ctx, t, generated) out, err := modGen. With(daggerQuery(`{child{root{entries}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"child":{"root":{"entries":["child","foo.go","go.mod"]}}}`, out) childEntries, err := generated.Entries(ctx) require.NoError(t, err) require.Contains(t, childEntries, "go.mod") require.Contains(t, childEntries, "go.sum") }) t.Run("respects existing main.go", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{ Contents: ` package main type HasMainGo struct {}
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
func (m *HasMainGo) Hello() string { return "Hello, world!" } `, }). With(daggerExec("mod", "init", "--name=hasMainGo", "--sdk=go")) logGen(ctx, t, modGen.Directory(".")) out, err := modGen. With(daggerQuery(`{hasMainGo{hello}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"hasMainGo":{"hello":"Hello, world!"}}`, out) }) t.Run("respects existing main.go even if it uses types not generated yet", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{ Contents: ` package main type HasDaggerTypes struct {} func (m *HasDaggerTypes) Hello() *Container { return dag.Container(). From("` + alpineImage + `"). WithExec([]string{"echo", "Hello, world!"}) } `, }). With(daggerExec("mod", "init", "--name=hasDaggerTypes", "--sdk=go")) logGen(ctx, t, modGen.Directory("."))
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
out, err := modGen. With(daggerQuery(`{hasDaggerTypes{hello{stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"hasDaggerTypes":{"hello":{"stdout":"Hello, world!\n"}}}`, out) }) t.Run("respects existing package without creating main.go", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("/work/notmain.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type HasNotMainGo struct {} func (m *HasNotMainGo) Hello() string { return "Hello, world!" } `, }). With(daggerExec("mod", "init", "--name=hasNotMainGo", "--sdk=go")) logGen(ctx, t, modGen.Directory(".")) out, err := modGen. With(daggerQuery(`{hasNotMainGo{hello}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"hasNotMainGo":{"hello":"Hello, world!"}}`, out) }) } func TestModuleGit(t *testing.T) { t.Parallel() type testCase struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
sdk string gitignores []string gitattributes string } for _, tc := range []testCase{ { sdk: "go", gitignores: []string{ "/dagger.gen.go\n", "/querybuilder/\n", }, }, { sdk: "python",
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
gitignores: []string{ "/sdk\n", }, }, } { tc := tc t.Run(fmt.Sprintf("module %s git", tc.sdk), func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := goGitBase(t, c). With(daggerExec("mod", "init", "--name=bare", "--sdk="+tc.sdk)) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen. With(daggerQuery(`{bare{myFunction(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"bare":{"myFunction":{"stdout":"hello\n"}}}`, out) t.Run("configures .gitignore", func(t *testing.T) { ignore, err := modGen.File(".gitignore").Contents(ctx) require.NoError(t, err) for _, gitignore := range tc.gitignores { require.Contains(t, ignore, gitignore) } }) }) } } func TestModuleGoGitRemovesIgnored(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) committedModGen := goGitBase(t, c). With(daggerExec("mod", "init", "--name=bare", "--sdk=go")). WithExec([]string{"rm", ".gitignore"}). WithExec([]string{"mkdir", "./internal"}). WithExec([]string{"cp", "-a", "./querybuilder", "./internal/querybuilder"}). WithExec([]string{"git", "add", "."}). WithExec([]string{"git", "commit", "-m", "init with generated files"}) changedAfterSync, err := committedModGen. With(daggerExec("mod", "sync")). WithExec([]string{"git", "diff"}). WithExec([]string{"git", "status", "--short"}). Stdout(ctx) require.NoError(t, err) t.Logf("changed after sync:\n%s", changedAfterSync) require.Contains(t, changedAfterSync, "D dagger.gen.go\n") require.Contains(t, changedAfterSync, "D querybuilder/marshal.go\n") require.Contains(t, changedAfterSync, "D querybuilder/querybuilder.go\n") require.Contains(t, changedAfterSync, "D internal/querybuilder/marshal.go\n") require.Contains(t, changedAfterSync, "D internal/querybuilder/querybuilder.go\n") } func TestModulePythonGitRemovesIgnored(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) committedModGen := goGitBase(t, c). With(daggerExec("mod", "init", "--name=bare", "--sdk=python")). WithExec([]string{"rm", ".gitignore"}). WithExec([]string{"git", "add", "."}). WithExec([]string{"git", "commit", "-m", "init with generated files"}) changedAfterSync, err := committedModGen. With(daggerExec("mod", "sync")). WithExec([]string{"git", "diff"}). WithExec([]string{"git", "status", "--short"}). Stdout(ctx) require.NoError(t, err) t.Logf("changed after sync:\n%s", changedAfterSync) require.Contains(t, changedAfterSync, "D sdk/pyproject.toml\n") require.Contains(t, changedAfterSync, "D sdk/src/dagger/__init__.py\n") } var goSignatures string func TestModuleGoSignatures(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: goSignatures, }) logGen(ctx, t, modGen.Directory(".")) t.Run("func Hello() string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{hello}}`)).Stdout(ctx)
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
require.NoError(t, err) require.JSONEq(t, `{"minimal":{"hello":"hello"}}`, out) }) t.Run("func Echo(string) string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echo(msg: "hello")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echo":"hello...hello...hello..."}}`, out) }) t.Run("func HelloContext(context.Context) string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{helloContext}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"helloContext":"hello context"}}`, out) }) t.Run("func EchoContext(context.Context, string) string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoContext(msg: "hello")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoContext":"ctx.hello...ctx.hello...ctx.hello..."}}`, out) }) t.Run("func HelloStringError() (string, error)", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{helloStringError}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"helloStringError":"hello i worked"}}`, out) }) t.Run("func HelloVoid()", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{helloVoid}}`)).Stdout(ctx)
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
require.NoError(t, err) require.JSONEq(t, `{"minimal":{"helloVoid":null}}`, out) }) t.Run("func HelloVoidError() error", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{helloVoidError}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"helloVoidError":null}}`, out) }) t.Run("func EchoOpts(string, Opts) error", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoOpts(msg: "hi")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOpts":"hi...hi...hi..."}}`, out) out, err = modGen.With(daggerQuery(`{minimal{echoOpts(msg: "hi", suffix: "!", times: 2)}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOpts":"hi!hi!"}}`, out) }) t.Run("func EchoOptsInline(string, struct{Suffix string, Times int}) error", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoOptsInline(msg: "hi")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptsInline":"hi...hi...hi..."}}`, out) out, err = modGen.With(daggerQuery(`{minimal{echoOptsInline(msg: "hi", suffix: "!", times: 2)}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptsInline":"hi!hi!"}}`, out) }) } var goExtend string func TestModuleGoExtendCore(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
t.Parallel() var logs safeBuffer c, ctx := connect(t, dagger.WithLogOutput(&logs)) _, err := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: goExtend, }). With(daggerExec("mod", "sync")). Sync(ctx) require.Error(t, err) require.NoError(t, c.Close()) require.Contains(t, logs.String(), "cannot define methods on objects from outside this module") } var customTypes string func TestModuleGoCustomTypes(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: customTypes, }) logGen(ctx, t, modGen.Directory(".")) out, err := modGen.With(daggerQuery(`{test{repeater(msg:"echo!", times: 3){render}}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"test":{"repeater":{"render":"echo!echo!echo!"}}}`, out) } func TestModuleGoReturnTypeDetection(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=foo", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Foo struct {} type X struct { Message string ` + "`json:\"message\"`" + ` } func (m *Foo) MyFunction() X { return X{Message: "foo"} } `, }) logGen(ctx, t, modGen.Directory(".")) out, err := modGen.With(daggerQuery(`{foo{myFunction{message}}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"foo":{"myFunction":{"message":"foo"}}}`, out) } var useInner string var useOuter string func TestModuleGoUseLocal(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/dep"). With(daggerExec("mod", "init", "--name=dep", "--sdk=go")). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=use", "--sdk=go")). WithNewFile("/work/dep/main.go", dagger.ContainerWithNewFileOpts{ Contents: useInner, }). WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{ Contents: useOuter, }). With(daggerExec("mod", "use", "./dep")). WithEnvVariable("BUST", identity.NewID()) logGen(ctx, t, modGen.Directory(".")) out, err := modGen.With(daggerQuery(`{use{useHello}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"use":{"useHello":"hello"}}`, out) _, err = modGen.With(daggerQuery(`{dep{hello}}`)).Stdout(ctx) require.Error(t, err) require.ErrorContains(t, err, `Cannot query field "dep" on type "Query".`) } func TestModuleGoUseLocalMulti(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,904
Zenith: fix handling of list inputs
```go package main import ( "fmt" ) type Test struct{} type Foo struct { Msg string } func (m *Test) TestListInput(foos []Foo) string { return fmt.Sprintf("%+v", foos) } ``` Currently fails when building the module w/ error `41: [0.44s] ./dagger.gen.go:4250:15: undefined: test` Something must have broken in handling of list input types at some point I'm guessing? cc @jedevc @vito This should at least work in terms of codegen, handling it in `dagger call` is also important but probably a separate task, unless of course we already handled it (cc @helderco)
https://github.com/dagger/dagger/issues/5904
https://github.com/dagger/dagger/pull/5907
db901c8fe4c70cc32336e304492ca37f12b8f389
e8ad5c62275172e3d54ae46447e741ff5d603450
2023-10-16T18:21:57Z
go
2023-10-25T19:38:59Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/foo"). WithNewFile("/work/foo/main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Foo struct {} func (m *Foo) Name() string { return "foo" } `, }). With(daggerExec("mod", "init", "--name=foo", "--sdk=go")). WithWorkdir("/work/bar"). WithNewFile("/work/bar/main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Bar struct {} func (m *Bar) Name() string { return "bar" } `, }). With(daggerExec("mod", "init", "--name=bar", "--sdk=go")).