thomasA
thomasA

Reputation: 297

Gitlab CI/CD Runner error: " unrecognized import path" GOLANG

I'm trying to implement CI/CD for a GO project

This is my gitlab-ci.yml file:

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)

Thanks for your help

Upvotes: 1

Views: 1219

Answers (1)

Yury Fedorov
Yury Fedorov

Reputation: 14928

You should use full paths in your import statements, e.g

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.

Upvotes: 1

Related Questions