Project scenario:
xxx.go xxx_unit test and code of test.go are open. The code is not in gopath and the project root set by idea.
Background:
Gopath:/users/ZYJ/go project root:/users/ZYJ/study/demogo source file:/users/ZYJ/study/demo/go/SRC/xxx_ test.go
Problem Description:
xxx.go xxx_test.go is stored separately xxx_test.go compilation error
command-line-arguments [command-line-arguments.test]
Cause analysis:
Go test XXX executed by golang IDE_test.go runs as file by default and does not import dependent files. You need to actively import dependencies
Usually: the project is in gopath or project root directory, and the dependency can be found normally
Solution:
go test -v xxxx.go xxxx_test.go
Golang ide multiple selections for quick operation
Read More:
- [Solved] Go Get Download Dependency Error: is not using a known version control system
- VScode: How to Solve golong plug-in install Error
- [Solved] VScode Error: build constraints exclude all Go files in syscall\js
- [Solved] Failed to resolve: com.serenegiant:common:1.5.20
- Vue Report Error #NULL! :no such file or directory,chmod….. [email protected] **\css- Beautify.js
- [Solved] Installing github.com/uudashr/gopkgs/v2/cmd/[email protected] FAILED和cannot install, GOBIN must be an ab
- [Solved] ambiguous import: found package github.com/spf13/cobra/cobra in multiple modules
- [Solved] panic: proto: duplicate enum registered: raftpb.EntryType
- [Solved] cannot find package “go.opentelemetry.io/otel/api/trace“ in any of
- [Solved] go cobra Error: required flag(s) “pkg-name” not set
- [GO] The entry file under the main package in golang calls other go file functions and appears undefined
- [Solved] npm install [email protected]~1.32 sass-loader deepmerge -D Install Error
- Maven package error: [WARNING] The POM for xxx is missing, no dependency inform
- [Solved] standard_init_linux.go:190: exec user process caused “exec format error“
- How to Solve Docker Run Error: standard_init_linux.go:219: exec user process caused: exec format error
- Failed to transform file ‘xxx‘ to match attributes [How to Solve]
- package golang.org/x/net/XXX: unrecognized import path “golang.org/x/net/xxx“…
- [Solved] There are test failures. Please refer to D:\Java_study\springboot\springboot-sugon-3\target\surefire-reports for the individual test results.
- How to Solve [error] malformed \uxxxx encoding Error
- [Solved] Compile Error: AAPT: error: resource android:attr/lStar not found