gpt4 book ai didi

docker - Gitlab CI/CD Runner 错误 : "unrecognized import path" GOLANG

转载 作者:行者123 更新时间:2023-12-01 22:28:01 28 4
gpt4 key购买 nike

我正在尝试为 GO 项目实现 CI/CD

这是我的 gitlab-ci.yml 文件:

image: golang:latest

variables:
REPO_NAME: gitlab.com/thomasaudo/website

before_script:
- cd $GOPATH/src
- mkdir -p gitlab.com/$CI_PROJECT_NAMESPACE
- cd gitlab.com/$CI_PROJECT_NAMESPACE
- ln -s $CI_PROJECT_DIR
- cd $CI_PROJECT_NAME

stages:
- test

format:
stage: test
script:
- go get ./...
- go fmt $(go list ./... | grep -v /vendor/)
- go vet $(go list ./... | grep -v /vendor/)
- go test -race $(go list ./... | grep -v /vendor/)

但是,我的运行者因以下错误而停止: package website/src/routes: unrecognized import path "website/src/routes" (import path does not begin with hostname)
谢谢你的帮助

最佳答案

您应该在导入语句中使用完整路径,例如

website/src/routes

应该成为
gitlab.com/thomasaudo/website/src/routes

此外,您似乎使用 govendor ,所以你可能错过了 govendor sync命令在您的构建步骤之一。

关于docker - Gitlab CI/CD Runner 错误 : "unrecognized import path" GOLANG,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58580587/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com