Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bitbucket pipelines for goland

aviram1202 March 1, 2020

Hi,

 

We are trying to build a pipelines for goLand.

For simple project is wok fine (with only main.go).

 

Our project have multi local packages:

myproject/
├── main.go
├── DB/
   └── DB1.go



we can't run the pipeline in bitbucket, we got an error:

main.go:4:2: cannot find package "aviramdevops/src/DB" in any of: /usr/local/go/src/aviramdevops/src/DB (from $GOROOT)
/go/src/aviramdevops/src/DB (from $GOPATH)


In localhost the command "go build" is successfully.
We got the error only in bitbucket pipeline.

Can you help me with that how to solved that case?

Thank you,
Aviram

main file:
==========
package main
import
(
"DB"
)
func main() {
DB.OpenConnection()
}
==========


bitbucket-pipelines.yml:
==========
image: golang:1.12
pipelines:
branches:
master:
- step:
script:
- source bitbucket-pipelines-go.sh
- cd ${IMPORT_PATH}
- go get
- go build
- go test
==========

 

 

1 answer

0 votes
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 1, 2020

Hello @aviram1202,

Welcome to the Community.

I'm not an expert in Go so can't tell much about the error apart from some package is not found.

Pipelines is actually running your script commands inside of a Docker container created from an image you specified. So there's nothing specific to Pipelines that fails your build, the problem is with the build configuration.

I'd advise you to debug your pipeline locally – this is very similar to what happens in the Cloud when your pipeline is triggered. Here's a guide on how to do that.

Hope this helps. Let me know if you have any questions.

Cheers,
Daniil

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events