杩愯绋嬪簭鏃舵姤go: cannot find main module, but found .git/config in
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了杩愯绋嬪簭鏃舵姤go: cannot find main module, but found .git/config in相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/ati' title='ati'>ati
off 娌℃湁 ase wrong pre creating find config缂栧啓鍗曞厓娴嬭瘯锛岃繍琛屾椂鎶ヤ笅闈㈢殑閿欒
haima@haima-PC:/media/haima/34E401CC64DD0E28/site/go/src/haimait/learn/base/cheshi01$ go test
go: cannot find main module, but found .git/config in /media/haima/34E401CC64DD0E28/site/go/src/haimait/learn
to create a module there, run:
cd ../.. && go mod init
鍑洪敊鍘熷洜鏄紑鍚簡go mod锛屼絾鏄病鏈夊垵浣垮寲鐢熸垚go.mod鏂囦欢
瑙e喅鏂规硶涓€锛?/p>
鍏抽棴gomod
haima@haima-PC:/media/haima/34E401CC64DD0E28/site/go/src/haimait/learn/base/cheshi01$ export GO111MODULE=off
haima@haima-PC:/media/haima/34E401CC64DD0E28/site/go/src/haimait/learn/base/cheshi01$ go env
GO111MODULE="off"
鈥︹€?#鐪佺暐
haima@haima-PC:/media/haima/34E401CC64DD0E28/site/go/src/haimait/learn/base/cheshi01$ go test
--- FAIL: TestAdd2 (0.00s)
cheshi01_test.go:16: result is wrong!
FAIL
exit status 1
FAIL haimait/learn/base/cheshi01 0.002s
瑙e喅鏂规硶浜?/p>
haima@haima-PC:/media/haima/34E401CC64DD0E28/site/go/src/haimait/learn/base/cheshi01$ go mod init
go: creating new go.mod: module haimait/learn/base/cheshi01
haima@haima-PC:/media/haima/34E401CC64DD0E28/site/go/src/haimait/learn/base/cheshi01$ go mod tidy
haima@haima-PC:/media/haima/34E401CC64DD0E28/site/go/src/haimait/learn/base/cheshi01$ go test
--- FAIL: TestAdd2 (0.00s)
cheshi01_test.go:16: result is wrong!
FAIL
exit status 1
FAIL haimait/learn/base/cheshi01 0.002s
haima@haima-PC:/media/haima/34E401CC64DD0E28/site/go/src/haimait/learn/base/cheshi01$ go test -v
=== RUN TestAdd1
TestAdd1: cheshi01_test.go:11: result is right!
--- PASS: TestAdd1 (0.00s)
=== RUN TestAdd2
TestAdd2: cheshi01_test.go:16: result is wrong!
--- FAIL: TestAdd2 (0.00s)
FAIL
exit status 1
FAIL haimait/learn/base/cheshi01 0.002s
以上是关于杩愯绋嬪簭鏃舵姤go: cannot find main module, but found .git/config in的主要内容,如果未能解决你的问题,请参考以下文章
Anaconda涓畨瑁呬簡Libtiff妯″潡锛屼絾杩愯绋嬪簭鏄剧ずModuleNotFoundError: No module named 'libtiff'