Tag Archives: go

[Solved] gitee Push Error: error: failed to push some refs to

Today, I created a project in gitee to push the local code. I found an error. The error is as follows:

error: failed to push some refs to 'https://gitee.com/xxxx'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Analysis reason:

Because readme The MD file is not in the local code directory


Execute the following command to set readme MD pull to local

git pull --rebase origin master

Then execute the following command to push the file

git push origin master

Go executable file error: sh:/ xxx: not found [How to Solve]


An error is reported when an executable file packaged by a project is executed in the alpine container


It is judged that the lack of dependent environment leads to the unrecognization of this executable file. Install glibc to solve the problem

You can also directly change the from image to busybox: glibc

cat Dockerfile 
FROM alpine:3.14
COPY xxx /tmp/
ARG TZ="Asia/Shanghai"
RUN  mkdir -p /opt/xxx && mv /tmp/xxx /tmp/ysera_mgtv.conf  /opt/xxx && \
     chmod 777 /opt/xxx/xxx && \
     sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories  && \
     apk add tzdata && ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime  && \
     wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
     wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk && \
     apk add glibc-2.29-r0.apk

USER root
CMD ["/opt/xxx/xxx"]

[Solved] Ubantu18.04 Use APT to install Go environment instruction Error

Under ubantu, the sudo apt install golang go instruction is used to install the go environment. No error is reported during the installation process. The instruction cannot be recognized during use. The error reports are as follows:

root@sh001:~# go env -w GOPROXY=https://goproxy.io,directflag provided but not defined: -w
usage: env [-json] [var ...]
Run 'go help env' for details.
root@sh001:~# go env GO111MODULE = on

Reason: the go environment is not completely installed, and the version installed with apt may be old


apt-get install software-properties-common

sudo add-apt-repository ppa:longsleep/golang-backports 
sudo apt-get update 
sudo apt-get install golang-go


 go version

[Solved] Go Language Error: cannot find module providing package github.com/


Gopath doesn’t work


After using the proxy to download the go package, there is a problem that the package cannot be found. Later, it is found that if the proxy is used, it will go to the PKG package to find the dependency


When goproxy is used, go111module is turned on, which causes package management to go to the directory of $gopath/SRC/PKG instead of being in the directory of $gopath/SRC/PKG.
for details, please refer to these two articles:
go get downloaded packages
to solve the problem that go can’t download
at this time, we need to use go mod to introduce these packages/ gin@latest, Solve the problem that import can’t get the package

That is, run the following two commands

 go mod init gin
 go mod edit -require github.com/gin-gonic/gin@latest

Go error reported unimplemented: 64 bit mode not compiled in and MinGW 64 bit installation error res resolved

Front end developers must read! Starting from scratch, teach you to build a low code website platform in stages>>>

Question 1: cc1.exe: sorry, unimplemented: 64 bit mode not compiled in

Reference: https://www.cnblogs.com/lesroad/p/10714367.html , indicating that MinGW needs to install 64 bit

Reference: https://www.cnblogs.com/ggg-327931457/p/9694516.html , download and install MinGW 64, what does each option mean when installing?This blog is very clear

Problem 2: error res is reported when installing mingw-w64-install.exe


Baidu found this problem in mingw-w64 download source bugs (address: https://sourceforge.net/p/mingw-w64/bugs/413/ ), the frequency is very high, patiently look at one by one, and finally see a solution:

Link to https://sourceforge.net/p/mingw-w64/mailman/message/32967954/ It is found that the GCC version is 4.9.1, not according to the default maximum version (8.1.0)


Therefore, the version 4.9.1 is selected for installation. Try the following:


Sure enough, the installation was successful

Configure environment variables, GCC – V test:


Then execute the go command to run perfectly~

Source of the original text: https://www.cnblogs.com/NolaLi/p/10761843.html

Gopath not set in go command execution

Why are there a series of technical challenges behind “OMG buy it”>>>

#Go installation directory?Go executor directory


export GOPATH=/Users/username/gopath

export PATH=$GOROOT/bin$GOPATH/bin

#Source/etc/profile after configuration

#Windows configuration is relatively simple, in the new two environment variables, go root, go path configuration, restart the machine after playing

Go Project Start Error: package not in GOROOT & import cycle not allowed

package not in GOROOT

That’s what I wrote at the beginning. I couldn’t find the package again. I was very strange at that time why I went to find it in Google. Later, I changed it to:

I still can’t find these packages. I wrote the directory completely from gopath/SRC

import cycle not allowed error reporting solution

modified code:

If this article helps you a little, please like it 👍 Let’s go