Answer the question
In order to leave comments, you need to log in
Why is my package not being imported?
Good afternoon, I'm trying to figure out the golang language.
I have: GOPATH=C:\Users\xxx\go
going to the given address, in the src folder I created the project
folder
In the project I created the test1 folder and there I created the main.go file:
package main
func main() {
Client1()
}
package van
//test
func Client1() {
println("test")
}
Answer the question
In order to leave comments, you need to log in
There are 2 main ways packages are located in Go:
Inside a directory specified in the GOPATH environment variable . This is where the src subdirectory should be. You put it there, for example, in src/mydir/mypackage.
Then everything in this src can be imported as import "mydir/mypackage"
The second way is with modules, but you don't use it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question