I am trying to experiment a bit with imports and now stuck on the station where simple import of package is failing in CircleCI while it is buildable locally successfully. Could anybody please share what is wrong or what I am doing wrong that is not letting code to be built in CircleCI?
Repo structure:
- project
--- main.go
--- graphic
----- graphics.go
main.go import definition:
package main
import (
"bufio"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"strings"
graphic "../project/graphic"
)
graphics.go import definition:
package graphic
import (
"fmt"
"io/ioutil"
"log"
"github.com/fogleman/gg"
)
CircleCI config.yml:
version: 2
jobs:
build:
docker:
- image: circleci/golang:1.9
working_directory: /go/src/github.com/<my-account>/project
steps:
- checkout
# specify any bash command here prefixed with `run: `
# - run: go get -v -t -d ./...
- run:
name: run filesystem path configuration
command: |
pwd
pwd -P
echo $GOROOT
echo $GOPATH
export GOBIN=$GOPATH/bin
echo $GOBIN
export PATH=$PATH:$GOBIN
ls -latr $GOROOT
ls -latr $GOPATH
ls -latr $GOBIN
go env
- run:
name: run dependecy managament
command: |
go get -v -u github.com/golang/dep/cmd/dep
go get -v -u github.com/fogleman/gg
go get -v -u github.com/aws/aws-sdk-go/aws
go get -v -u github.com/aws/aws-sdk-go/aws/session
go get -v -u github.com/aws/aws-sdk-go/service/cloudwatch
- run:
name: run documentation
command: |
godoc -v -index -timestamps main
- run:
name: run tests
command: |
go vet -v ./...
- run:
name: run build and deploy
command: |
dep init
mkdir build
dep ensure
go build -v -o build/main.exe main.go
- run:
name: run qa
command: go test -v main.go
- store_artifacts:
path: ./build
Failing error message:
#!/bin/bash -eo pipefail
dep init
mkdir build
dep ensure
go build -v -o build/main.exe main.go
Using ^1.3.0 as constraint for direct dep github.com/fogleman/gg
Locking in v1.3.0 (0403632) for direct dep github.com/fogleman/gg
Locking in master (cff245a) for transitive dep golang.org/x/image
Using ^1.23.3 as constraint for direct dep github.com/aws/aws-sdk-go
Locking in v1.23.3 (fbdf1bd) for direct dep github.com/aws/aws-sdk-go
Locking in master (e2365df) for transitive dep github.com/golang/freetype
Locking in (c2b33e84) for transitive dep github.com/jmespath/go-jmespath
graphic/graphics.go:8:2: cannot find package "_/go/src/github.com/<my-account>/project/vendor/github.com/fogleman/gg" in any of:
/usr/local/go/src/_/go/src/github.com/<my-account>/project/vendor/github.com/fogleman/gg (from $GOROOT)
/go/src/_/go/src/github.com/<my-account>/project/vendor/github.com/fogleman/gg (from $GOPATH)
Exited with code 1
i think for your case will solve if you use package manager, like DEP or other.