Skip to content
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

go file cant process dot import. #249

Open
soluty opened this issue Sep 11, 2023 · 2 comments
Open

go file cant process dot import. #249

soluty opened this issue Sep 11, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@soluty
Copy link

soluty commented Sep 11, 2023

Describe the bug
i use dot report in .go file, it cant work fine.

To Reproduce
foo/foo.go content:

func Foo() {
   print(123)
}

main.go content:

import . "foo" 
func main() {
   Foo()
}

then i run SnipRun in line Foo(), and it cant compile fine.

Expected behavior
it can process the situation with dot import .

@michaelb
Copy link
Owner

I can't even make this work outside of sniprun though.
Go complains about relative paths not being a thing in module mode, not that I understand what it means...

Do you have a complete example that I could go run example.go (and then try to make work inside sniprun) ?

@soluty
Copy link
Author

soluty commented Sep 16, 2023

I can't even make this work outside of sniprun though. Go complains about relative paths not being a thing in module mode, not that I understand what it means...

Do you have a complete example that I could go run example.go (and then try to make work inside sniprun) ?

i am sorry , i just make a mistake. it is in go module.

go.mod

module test
go 1.19

main.go

package main

import . "main/foo"

func main() {
	Foo()
}

foo/foo.go

package foo

import "fmt"

func Foo(){
  fmt.Println("foo")
}

now you can go run main.go, and when i select the line Foo(), i hope this could work, now it will get a compile error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants