Home > Software design >  Unable to run golangci-lint on bitbuckt CI
Unable to run golangci-lint on bitbuckt CI

Time:03-11

I have setup golangci-lint in my development enviroment with configuring makefile,

MakeFile

build: lint_provider
    go build -o ${BINARY}

lint_provider:
    golangci-lint run -c .golangci.yml

install: build
    mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}...
    mv ${BINARY} ~/terraform.d/plugins/....
   

bitbucket-pipelines.yml

pipelines:
  default:
    - step:
      image:
        hashicorp/terraform:latest
      script:
        - apk add go
        - apk add make
        - wget -0- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.44.2
        - make install
        - cd terraformprovider/examples/test
        - ./testall.sh

this pipelining failed with

  make install
golangci-lint run -c .golangci.yml
make: golangci-lint: No such file or directory
make: *** [Makefile:12: lint_provider] Error 127

Makefile : 12 is golangci-lint run -c .golangci.yml

the same setup is working with the development environment in the development environment, golangci-lint installed with brew install golangci-lint

how do I execute golangci-lint with bitbucket pipeline environment?

CodePudding user response:

Looks like golangci-lint isnt installed succesfully or installed in the directory outside of the PATH

By default this installer uses ./bin directory, so you can try ./bin/golangci-lint run -c .golangci.yml, or you can use BINDIR variable to set installation path.

  • Related