Knowledge map advanced must read: read how large-scale map data efficient storage and retrieval>>>
If you want to use gopath mode to import packages from SRC directory, you need to close gomod mode
export GO111MODULE=off
If you use go mod mode
export GO111MODULE=on
And execute go mod init in the directory
Otherwise, it will report an error
package wang/test is not in GOROOT (/usr/local/go/src/wang/test)
main.go
package main
import (
"wang/test"
"wang/test/yong"
)
func main() {
test.Say()
yong.Speak()
}
test.go
package test
import "fmt"
func Say() {
fmt.Println("i am test")
}
yong.go
package yong
import "fmt"
func Speak() {
fmt.Println("i am speak")
}
Similar Posts:
- ping: www.bing.com: Temporary failure in name resolution
- PHP executable not found. Install PHP 7 and add it to your PATH or set the php.executablePath s
- TypeError: ‘module’ object is not callable
- A non well formed numeric value encountered
- ‘InnoDB’ init function returned error.[mysql5.6]
- Error 502 when accessing PHP file by phpstorm browser
- pandas.read_ Oserror: initializing from file failed
- nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
- Phpstorm display localhost:63342 And 502 bad Gateway Solutions
- Solution of invalid order address prompted by Magento PayPal