(format string, err error)
| 1240 | } |
| 1241 | |
| 1242 | func localModuleErrorf(format string, err error) error { |
| 1243 | if err == nil { |
| 1244 | return nil |
| 1245 | } |
| 1246 | |
| 1247 | wrapped := fmt.Errorf(format, err) |
| 1248 | if moduleURL != "" { |
| 1249 | return fmt.Errorf("%w\nhint: module source came from --mod=%q; if you intended local, pass `--mod .`", wrapped, moduleURL) |
| 1250 | } |
| 1251 | if envRef, ok := os.LookupEnv("DAGGER_MODULE"); ok { |
| 1252 | return fmt.Errorf("%w\nhint: module source came from DAGGER_MODULE=%q; if you intended local, pass `--mod .`", wrapped, envRef) |
| 1253 | } |
| 1254 | return wrapped |
| 1255 | } |
| 1256 | |
| 1257 | // Wraps a command with optional module loading. If a module was explicitly specified by the user, |
| 1258 | // it will try to load it and error out if it's not found or invalid. If no module was specified, |
no outgoing calls
no test coverage detected