Go language go get error

go language go get error:

D:\workspace\www\go_work\src
 go get -u github.com/swaggo/gin-swagger
package golang.org/x/text/secure/bidirule: golang.org/x/text is a custom import path for https://go.googlesource.com/text, but D:\workspace\www\go_work\src\golang.org\x\text is checked out from https://github.com/golang/text.git
package golang.org/x/text/unicode/bidi: golang.org/x/text is a custom import path for https://go.googlesource.com/text, but D:\workspace\www\go_work\src\golang.org\x\text is checked out from https://github.com/golang/text.git
package golang.org/x/text/unicode/norm: golang.org/x/text is a custom import path for https://go.googlesource.com/text, but D:\workspace\www\go_work\src\golang.org\x\text is checked out from https://github.com/golang/text.git
package golang.org/x/text/width: golang.org/x/text is a custom import path for https://go.googlesource.com/text, but D:\workspace\www\go_work\src\golang.org\x\text is checked out from https://github.com/golang/text.git

what should I do?

Nov.05,2021

climbing over the wall can solve the problem from the root, and will not do it again, reducing the workload and time waste in the future


try go mod replace

module example.com/hello

require (
    golang.org/x/text v0.3.0
)

replace (
    golang.org/x/text => github.com/golang/text v0.3.0
)

what to do when the network is not connected:

the first is to go to github to download the package and put text under golang.org/x/

the second is to use the package management tool glide: ide" rel=" nofollow noreferrer "> https://github.com/Mastermind., and change the address of the warehouse

.

glide.yaml

package: test
import:
- package: golang.org/x/text
  repo: https://github.com/golang/text
  version: 5cec4b58c438bd98288aeb248bab2c1840713d21

it is recommended to clone the corresponding package on github:
for example

  1. mkdir $GOPATH/src/golang.org/x
  2. cd $GOPATH/src/golang.org/x & & git clone git@github.com:golang/text.git

use goproxy, such as https://goproxy.io/


try goproxy

Menu