Attempted to install a tool using the instructions on Github but get a error when try to run


I am ovbviously not au fait with building from Github repos but would really appreciate some help.

OS: Kali Linux (5.15.0-kali2-amd64)

I am trying to build per the instructions here:

The build seems to install OK:

sudo docker build . -t padcheck

Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
STEP 1/15: FROM alpine:3.9
STEP 2/15: RUN apk add --no-cache               ca-certificates
--> Using cache d7c12b042fcc42a2ef3ec1733900a720263cf64b8d69cbd05b1189133a8f2f8e
--> d7c12b042fc
STEP 3/15: RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
--> Using cache 7feea938c3cf5def2e55edbe0f515c83ec3a608a045f6f15ac3ead6448fae86b
--> 7feea938c3c
STEP 4/15: COPY ./paddingmodes-go1.11.diff /tmp/paddingmodes-go1.11.diff
--> Using cache dc9c476290cadbfce6c23b5c86fe7cac8a92f52924ab537680be72341a389641
--> dc9c476290c
--> Using cache 14ad60e2e84e634cfa252abad776eeb513752eefee542de803950bbfb64be5b7
--> 14ad60e2e84
STEP 6/15: RUN set -eux;        apk add --no-cache --virtual .build-deps                bash            gcc        musl-dev                 openssl                 go      ;       export          GOROOT_BOOTSTRAP="$(go env GOROOT)"GOOS="$(go env GOOS)"            GOARCH="$(go env GOARCH)"               GOHOSTOS="$(go env GOHOSTOS)"           GOHOSTARCH="$(go env GOHOSTARCH)"   ;       apkArch="$(apk --print-arch)";  case "$apkArch" in              armhf) export GOARM='6' ;;          x86) export GO386='387' ;;      esac;           wget -O go.tgz "$GOLANG_VERSION.src.tar.gz";        echo 'bc1ef02bb1668835db1390a2e478dcbccb5dd16911691af9d75184bbe5aa943e *go.tgz' | sha256sum -c -;   tar -C /usr/local -xzf go.tgz;  rm go.tgz;              cd /usr/local/go/src;   patch -p2 < /tmp/paddingmodes-go1.11.diff;  rm /tmp/paddingmodes-go1.11.diff;       ./make.bash;            rm -rf          /usr/local/go/pkg/bootstrap                 /usr/local/go/pkg/obj   ;       apk del .build-deps;            export PATH="/usr/local/go/bin:$PATH";      go version
--> Using cache 9299711dd2046598f08f1dedceb322af2d2723797664a698a4f322290d37e097
--> 9299711dd20
--> Using cache 7b9bebc3e577b5e6976b16a7c9e21115959836b06f49f87d693f924245769478
--> 7b9bebc3e57
--> Using cache 7ffb2e13401e316132b5d0572e5313eab602ecb91bb9a7d60a8e4b0f5d5391b2
--> 7ffb2e13401
STEP 9/15: ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
--> Using cache 18ae898383c2553a814df7913e3be77123e8a6a3673ae2d17ea4feaf50f06410
--> 18ae898383c
STEP 10/15: RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
--> Using cache 03ae353817062bf2f135999e0ba4b01dc3dcb23e7da6e48f6990ed9502b5379b
--> 03ae3538170
--> Using cache d01b2a8bb52880b155919645013b3dc4b548a8da4feae75892b75f115eb83b11
--> d01b2a8bb52
STEP 12/15: COPY padcheck.go /go/src
--> Using cache 1435510254fccb68633b033e0e88da685215f34420094cfb695bd230fe64493b
--> 1435510254f
STEP 13/15: RUN cd /go/src && go install padcheck.go
--> Using cache 82a8ba8ed6255289ea31e26ecc341d58ddef964e201a644902a8294ad8cb5ba9
--> 82a8ba8ed62
STEP 14/15: ENTRYPOINT ["/go/bin/padcheck"]
--> Using cache 6fcadceec4f2de2365d84ae96a7e9906727709ecfe46cd4f692299ca1a41f650
--> 6fcadceec4f
STEP 15/15: CMD ["-h"]
--> Using cache 80892f2bf809ca96bfd6abb7ff049353edde423964804a194d0ff6e39af44c39
COMMIT padcheck
--> 80892f2bf80
Successfully tagged localhost/padcheck:latest

But when I run (using docker run --rm -it padcheck):

Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
Error: short-name "padcheck" did not resolve to an alias and no unqualified-search registries are defined in "/etc/containers/registries.conf"

And using golang-go:

sudo ./

--2022-02-22 10:49:41--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: [following]
--2022-02-22 10:49:42--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21058849 (20M) [application/x-gzip]
Saving to: ‘go1.11.tar.gz.2’

go1.11.tar.gz.2              100%[==============================================>]  20.08M  14.0MB/s    in 1.4s

2022-02-22 10:49:43 (14.0 MB/s) - ‘go1.11.tar.gz.2’ saved [21058849/21058849]

patching file src/crypto/tls/common.go
patching file src/crypto/tls/conn.go
patching file src/crypto/tls/handshake_client.go
patching file src/crypto/tls/handshake_server.go
Building Go cmd/dist using /usr/lib/go-1.17.
go: cannot find main module, but found .git/config in /home/padcheck
        to create a module there, run:
        cd ../.. && go mod init

└─$ cd /home/padcheck && go mod init

go: cannot determine module path for source directory /home/padcheck (outside GOPATH, module path must be specified)

Example usage:
        'go mod init' to initialize a v0 or v1 module
        'go mod init' to initialize a v2 module

Run 'go help mod init' for more information.


You’re trying to run padcheck but your container is called localhost/padcheck as you can see in the second to last line of your build output:

Successfully tagged localhost/padcheck:latest

Run it like docker run --rm -ti localhost/padcheck instead

As for the golang problem:
The script is downloading golang 1.11 in which you could have projects without a gomod more frequently, hence no gomod files exist in that repo.
However, you can "fix" this like follows:

$ go mod init
go: creating new go.mod: module
go: to add module requirements and sums:
        go mod tidy
$ go mod tidy

Answered By – Rick Rackow

Answer Checked By – Willingham (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.