Skip to content

Commit

Permalink
[#47] [Pipeline] Fix YDBGo pipeline failure in lint_code job due to G…
Browse files Browse the repository at this point in the history
…O111MODULE=off

**Problem**

After bump YDBGo wrapper version to odd development version v1.2.5 in YDBGo!185, Daily pipeline failed with this error.
```shell
$ go get -u golang.org/x/lint/golint
345# golang.org/x/tools/go/types/objectpath
346/go/src/golang.org/x/tools/go/types/objectpath/objectpath.go:397:10: meth.Origin undefined (type *types.Func has no field or method Origin)
```

**Cause**

The cause of this problem likely to be `GO111MODULE=off` (Reference : dominikh/go-tools#653, #47).
From the reference GO111MODULE=off might have some problem with linter.

**Solution**

Change `GO111MODULE=off` to `GO111MODULE=on` but in only lint_code section to reduce impact to the whole pipeline.
But after `GO111MODULE=on` some change need to be apply here because we're using Go module.

After some research, `go get -u golang.org/x/lint/golint` need to change to `go install golang.org/x/lint/golint@latest`.

`go get` when `GO111MODULE=off` will download source package and compiled it to a binary but `GO111MODULE=on`, it won't.
So, `go install` would be a solution because it will download source code and compile it to binary as we want.
(Reference : https://medium.com/@chaewonkong/difference-between-go-get-and-go-install-in-go-a076d7352186)
  • Loading branch information
Jirapat Distaprom committed Mar 12, 2024
1 parent f76fa18 commit 4fafa69
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#################################################################
# #
# Copyright (c) 2018-2023 YottaDB LLC and/or its subsidiaries. #
# Copyright (c) 2018-2024 YottaDB LLC and/or its subsidiaries. #
# All rights reserved. #
# #
# This source code contains the intellectual property #
Expand Down Expand Up @@ -117,9 +117,9 @@ lint_code:
variables:
GOLANG_VERSION: "1.18.10"
script:
- go get -u golang.org/x/lint/golint
- find / -name "*lint*"
- ${GOBIN}/golint -set_exit_status $(go list ./... | grep -v /vendor/ | grep -v /internal/)
- export GO111MODULE=on
- go install golang.org/x/lint/golint@latest
- golint -set_exit_status $(go list ./... | grep -v /vendor/ | grep -v /internal/)

error_codes:
stage: test
Expand Down

0 comments on commit 4fafa69

Please sign in to comment.