我有一个简单的 go 包,但是在 Github Actions 中进行测试期间,它因以下错误而失败:
##[error]keywords.go:8:2: cannot find package "github.com/securisec/go-keywords/languages" in any of:.
当我在本地运行测试时(我使用的是 go mod),所有测试都运行良好。
对于 Github 操作,我尝试将GO111MODULE两者都设置为on和off,但仍然遇到相同的错误。
可以在此处观察到错误。我的测试工作流程是:
name: tests
on:
- push
- pull_request
jobs:
test:
name: Test package
strategy:
max-parallel: 3
fail-fast: false
matrix:
os:
- ubuntu-latest
go:
- "1.11"
- "1.13"
- "1.14"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
env:
GOPATH: ${{ runner.workspace }}
GO111MODULE: "on"
- name: Go setup
uses: actions/setup-go@v1.0.0
with:
go-version: ${{matrix.go}}
env:
GOPATH: ${{ runner.workspace }}
GO111MODULE: "on"
- name: Run test
env:
GOPATH: ${{ runner.workspace }}
GO111MODULE: "on"
run: |
go get -u github.com/grokify/html-strip-tags-go
go test ./...
- if: failure()
run: ls -R
去模组文件:
module github.com/securisec/go-keywords
go 1.14
require github.com/grokify/html-strip-tags-go v0.0.0-20200322061010-ea0c1cf2f119
我该如何解决这个错误?
千巷猫影
相关分类