CircleCI构建失败时本地构建成功

时间:2019-08-18 14:44:51

标签: go circleci-2.0 circleci-workflows

我正在尝试对导入进行一些试验,现在卡在了CircleCI 无法成功在本地成功构建的简单软件包导入失败的站点上。任何人都可以分享不允许我在CircleCI中构建代码的错误或我正在做的错误吗?

回购结构:

    - project
    --- main.go
    --- graphic
    ----- graphics.go

main.go导入定义:

    package main

    import (
        "bufio"
        "flag"
        "fmt"
        "io/ioutil"
        "log"
        "os"
        "strings"

        graphic "../project/graphic"
    )

graphics.go导入定义:

    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

失败错误消息:

    #!/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

1 个答案:

答案 0 :(得分:0)

我认为,如果您使用DEP或其他软件包管理器,对于您的情况将解决。