0

我正在尝试对导入进行一些试验,现在卡在 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
4

1 回答 1

0

我认为如果你使用包管理器,如 DEP 或其他,你的情况会解决。

于 2019-08-21T06:23:43.567 回答