Skip to content

Makefile build failure #113

@oldkingcone

Description

@oldkingcone

It appears the makefile or some dependency management in the build process calls a deprecated call within go, its using go get rather than go install or go mod tidy (to download go packages) in Tools/src/checkstyle.sh

Try update 'goimports'
go: go.mod file not found in current directory or any parent directory.
        'go get' is no longer supported outside a module.
        To build and install a command, use 'go install' with a version,
        like 'go install example.com/cmd@latest'
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.
Run 'goimports'
#!/usr/bin/env bash
echo "Run checkstyle script"

# run gofmt
echo "Run 'gofmt'"
unformatted=$(gofmt -l `pwd`/src/)
if [[ -n $unformatted ]]; then
        echo >&2 "Error: Found files not formatted by gofmt"
        for fi in $unformatted; do
                echo >&2 $fi
        done
        echo "Please run 'gofmt -w' for files listed."
        exit 1
fi

# run goimports
echo "Try update 'goimports'"
GOPATH=`pwd`/Tools go get golang.org/x/tools/cmd/goimports # go mod tidy or go install

echo "Run 'goimports'"
unformatted=$(Tools/bin/goimports -l `pwd`/src/)
if [[ -n $unformatted ]]; then
        echo >&2 "Error: Found files not formatted by goimports"
        for f in $unformatted; do
                echo >&2 $f
        done
        echo "Please run 'goimports -w' for files listed."
        exit 1
fi

echo "Run 'go vet'"
ln -s `pwd` `pwd`/vendor/src/github.com/aws/session-manager-plugin
go vet ./src/...

Edit:

Also appears the dependency tools/cmd/goimports does not seem to exist any longer (after changing the line identified above on my system):

Try update 'goimports'
cannot find package "golang.org/x/tools/cmd/goimports" in any of:
        /usr/lib/go-1.24/src/golang.org/x/tools/cmd/goimports (from $GOROOT)
        /home/kali/src/session-manager-plugin-1.2.707.0/Tools/src/golang.org/x/tools/cmd/goimports (from $GOPATH)
Run 'goimports'
/home/kali/src/session-manager-plugin-1.2.707.0/Tools/src/checkstyle.sh: line 21: Tools/bin/goimports: No such file or directory

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions