简体   繁体   English

Gitlab CI/CD Runner 错误:“无法识别的导入路径” GOLANG

[英]Gitlab CI/CD Runner error: “ unrecognized import path” GOLANG

I'm trying to implement CI/CD for a GO project我正在尝试为 GO 项目实施 CI/CD

This is my gitlab-ci.yml file:这是我的 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/)

However, my runner stopped with the following error: package website/src/routes: unrecognized import path "website/src/routes" (import path does not begin with hostname)但是,我的跑步者因以下错误停止: package website/src/routes: unrecognized import path "website/src/routes" (import path does not begin with hostname)

Thanks for your help谢谢你的帮助

You should use full paths in your import statements, eg您应该在导入语句中使用完整路径,例如

website/src/routes

should become应该成为

gitlab.com/thomasaudo/website/src/routes

Also, it looks like you use govendor , so you are probably missing govendor sync command in one of your build steps.此外,您似乎使用govendor ,因此您可能在构建步骤之一中缺少govendor sync命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM