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

Package import structure of maths unclear #693

Open
SubtleCo opened this issue Aug 4, 2023 · 1 comment
Open

Package import structure of maths unclear #693

SubtleCo opened this issue Aug 4, 2023 · 1 comment

Comments

@SubtleCo
Copy link

SubtleCo commented Aug 4, 2023

Digging around, I see there's been some conversation about how the package titles suddenly changed, and we now have two packages, one called package clockface and one called package clockface_test. The sample online has the projectpath as a GitHub URL, which may be normal but up to this point, we haven't been introduced to this style of import.

I ended up making it work with both a go mod init clockface and a go work init . which got my linter to play nice, but I'm not 100% sure on what I did.

I think if you're going to change up the import style from what's been consistent before this chapter, an explanation and instruction is called for, especially for those of us using this track to learn Go for the first time.

THANK YOU all! This has been a wonderful experience so far

@SubtleCo
Copy link
Author

SubtleCo commented Aug 4, 2023

Thinking about it a bit more - I think it just didn't click in my head that what I name my go mod at the root project level had the effect of defining package paths.

I ended up deleting my local go mod and go work files from the maths dir and edited my go.mod at the root (in my case, go_with_tests/) to say "module go_with_tests"

This allowed me in the test file to use
import "go_with_tests/maths"
given that I had a file clock.go with package clockface at the top of the file.

Anyway, all this to say - I'm nitpicking. This tutorial has been so wonderfully self sufficient, and this was my first real hiccup. It would be cool to smooth over, and I wonder if that happens in ch. 1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant