-
-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bud run fails right after adding controller following video #369
Comments
Hey @mysiar, thanks for trying out Bud! Can you share your I think you're missing |
I'd also recommend bumping to |
same issue, v0.2.7 tested under WSL 2 (Ubuntu 22.04) on WIN11 22H2 and Ubuntu 22.04 VM under Hyper-V looks like the file "bud/internal/web/web.go" (and the bud/internal/web folder) was removed after run "bud new contoller xxx" i'll test v0.2.8 today it is the same using v0.2.8, bud/internal/web is missing after run bud new controller |
Hmm, that's really odd. I was able to reproduce that in v0.2.7, but not in v0.2.8. Are you able to reliably reproduce bud/internal/web getting removed? If you restart |
made a recording(new controller when and I also tried to run new controller when bud not running , the same issue |
you are right ,sorry, it's maybe not the same issue. my go env under WSL 2: ➜ ~ go env |
@qindj shouldn't |
see: |
@qindj do you know what So the error is right here: Line 99 in da81926
Bud is mapping the Line 105 in da81926
There seems to be an issue turning bud/framework/controller/loader.go Line 335 in da81926
Would you have time to look into this? If so, the contributing guide can help you install Bud locally. I feel like if you're able to |
i'll have a try to find the problem btw: should we start a new issue? |
I think it's fine to keep it in this issue, but whatever you prefer. |
I think i found the "problem" under Ubuntu 22.04 , Golang is installed under /usr/share/go-1.1x, and some symbolic links are created under /usr/lib/go-1.1x
Line 158 in 061c0f1
that's why |
Supppper helpful @qindj, thank you! It seems like the parser's package directory doesn't match up with the more correct module directory. Do you mind changing the following and trying again? diff --git a/package/parser/parser.go b/package/parser/parser.go
index 693793d..efd04bc 100644
--- a/package/parser/parser.go
+++ b/package/parser/parser.go
@@ -53,7 +53,7 @@ func (p *Parser) Parse(dir string) (*Package, error) {
}
parsedPackage.Files[filename] = parsedFile
}
- pkg := newPackage(dir, p, p.module, parsedPackage)
+ pkg := newPackage(imported.Dir, p, p.module, parsedPackage)
return pkg, nil
} I think if we use Go's import system it will eval symlinks already, but if not, I have another idea. |
Tested, not working, both of |
Thanks for testing! I guess I was able to reproduce this in a Docker container. Could you check if this is working as expected? diff --git a/package/gomod/module.go b/package/gomod/module.go
index c6d90c6..c573626 100644
--- a/package/gomod/module.go
+++ b/package/gomod/module.go
@@ -91,12 +91,23 @@ func (m *Module) ReadDir(name string) ([]fs.DirEntry, error) {
}
// ResolveImport returns an import path from a local directory.
-func (m *Module) ResolveImport(directory string) (importPath string, err error) {
- relPath, err := filepath.Rel(m.dir, filepath.Clean(directory))
+func (m *Module) ResolveImport(dir string) (importPath string, err error) {
+ return m.resolveImport(dir, true)
+}
+
+func (m *Module) resolveImport(dir string, evalSymlinks bool) (string, error) {
+ relPath, err := filepath.Rel(m.dir, dir)
if err != nil {
return "", err
} else if strings.HasPrefix(relPath, "..") {
- return "", fmt.Errorf("%q can't be outside the module directory %q", directory, m.dir)
+ if !evalSymlinks {
+ return "", fmt.Errorf("module: unable to resolve import. %q can't be outside the module directory %q", dir, m.dir)
+ }
+ // Maybe the directory is a symlink, resolve that symlink and try again.
+ if dir, err = filepath.EvalSymlinks(dir); err != nil {
+ return "", fmt.Errorf("module: unable to resolve import for %q. %w", dir, err)
+ }
+ return m.resolveImport(dir, false)
}
return m.Import(relPath), nil
} |
tested and confirmed, it's working! Thank you! |
error message:
my go env
any suggestion ho to solve it is more than welcome
The text was updated successfully, but these errors were encountered: