From d73725709b043bd9f35eefe4834375e99f6cc3c1 Mon Sep 17 00:00:00 2001 From: Alexander Bezzubov Date: Thu, 11 Apr 2019 15:03:12 +0200 Subject: [PATCH 1/7] ci: fix versions to workaround compiler release :bug: Signed-off-by: Alexander Bezzubov --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 229fa891..143bd309 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,11 @@ language: go go_import_path: gopkg.in/src-d/enry.v1 go: - - '1.11.x' - - '1.10.x' + - '1.11.6' + - '1.12.1' env: global: - - GO_VERSION_FOR_JVM='1.11.x' + - GO_VERSION_FOR_JVM='1.11.' matrix: - ONIGURUMA=0 - ONIGURUMA=1 From 58a81694f68055b899343a2a38b10f679d79c959 Mon Sep 17 00:00:00 2001 From: Alexander Bezzubov Date: Tue, 9 Apr 2019 18:58:14 +0200 Subject: [PATCH 2/7] ci: fix bug that enabled oniguruma for all profiles Signed-off-by: Alexander Bezzubov --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 143bd309..3ec112f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ stages: stage: test install: - - if [[ -n "$ONIGURUMA" ]]; then tags="$tags oniguruma"; fi; go get -v -t --tags "$tags" ./... + - if [[ "${ONIGURUMA}" -gt 0 ]]; then export tags="${tags} oniguruma"; fi; go get -v -t -tags "${tags}" ./... script: - make test-coverage after_success: From 5fab94b5b97b29995f672d794855ce364cd1065a Mon Sep 17 00:00:00 2001 From: Alexander Bezzubov Date: Tue, 9 Apr 2019 19:17:55 +0200 Subject: [PATCH 3/7] ci: disable cgo by default With go1.11 `go test` in GOPATH mode somehow seems to depend on GCC. See https://github.com/golang/go/issues/28065 This change only enables cgo for CI profiles that need it. Those are the ones that seem to fail on TravisCI now, presumably due to some compiler version missmatch. That is a workaround and does not happen in GO11MODULE mode. Signed-off-by: Alexander Bezzubov --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3ec112f0..a6113fda 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,8 @@ go: - '1.12.1' env: global: - - GO_VERSION_FOR_JVM='1.11.' + - GO_VERSION_FOR_JVM='1.11.1' + - CGO_ENABLED=0 matrix: - ONIGURUMA=0 - ONIGURUMA=1 @@ -30,7 +31,7 @@ stages: stage: test install: - - if [[ "${ONIGURUMA}" -gt 0 ]]; then export tags="${tags} oniguruma"; fi; go get -v -t -tags "${tags}" ./... + - if [[ "${ONIGURUMA}" -gt 0 ]]; then export tags="${tags} oniguruma"; CGO_ENABLED=1; fi; go get -v -t -tags "${tags}" ./... script: - make test-coverage after_success: @@ -43,6 +44,7 @@ jobs: language: scala jdk: oraclejdk8 before_install: + - CGO_ENABLED=1 # mimics exact behavior of 'go_import_path' for non-go build image - export GOPATH=${TRAVIS_HOME}/gopath - mkdir -p ${GOPATH}/src/gopkg.in/src-d/enry.v1 @@ -122,6 +124,7 @@ jobs: language: scala jdk: oraclejdk8 before_install: + - CGO_ENABLED=1 # mimics exact behavior of 'go_import_path' for non-go build image - export GOPATH=${TRAVIS_HOME}/gopath - mkdir -p ${GOPATH}/src/gopkg.in/src-d/enry.v1 From 110822b0144b250e9a1a615f43211ef896f41fd3 Mon Sep 17 00:00:00 2001 From: Alexander Bezzubov Date: Tue, 9 Apr 2019 19:44:30 +0200 Subject: [PATCH 4/7] ci: remove 'sudo: false' as it's deprecated on Travis See https://docs.travis-ci.com/user/reference/trusty/#container-based-infrastructure and https://blog.travis-ci.com/2018-11-19-required-linux-infrastructure-migration#timeline---its-happening-fast Signed-off-by: Alexander Bezzubov --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a6113fda..e0aaf740 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -sudo: false dist: trusty language: go From 41478262f39c4b1a4a8d7719cb037efb082139ee Mon Sep 17 00:00:00 2001 From: Alexander Bezzubov Date: Tue, 9 Apr 2019 15:54:31 +0200 Subject: [PATCH 5/7] fix verb mismatch in a format string Signed-off-by: Alexander Bezzubov --- internal/code-generator/generator/heuristics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/code-generator/generator/heuristics.go b/internal/code-generator/generator/heuristics.go index 4e75a97f..1231c884 100644 --- a/internal/code-generator/generator/heuristics.go +++ b/internal/code-generator/generator/heuristics.go @@ -51,7 +51,7 @@ func loadHeuristics(yaml *Heuristics) (map[string][]*LanguagePattern, error) { // unroll to a single map for _, ext := range disambiguation.Extensions { if _, ok := patterns[ext]; ok { - return nil, fmt.Errorf("cannt add extension '%s', it already exists for %q", ext, patterns[ext]) + return nil, fmt.Errorf("cannt add extension '%s', it already exists for %+v", ext, patterns[ext]) } patterns[ext] = rules } From 85de120c1739f2618a9e1851bb2062cb21e87c4f Mon Sep 17 00:00:00 2001 From: Alexander Bezzubov Date: Thu, 11 Apr 2019 21:35:49 +0200 Subject: [PATCH 6/7] ci: export env vars Signed-off-by: Alexander Bezzubov --- .travis.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index e0aaf740..985a41df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ language: go go_import_path: gopkg.in/src-d/enry.v1 go: - - '1.11.6' + - '1.11.6' # specific versions until https://github.com/golang/go/issues/31293 - '1.12.1' env: global: @@ -30,7 +30,12 @@ stages: stage: test install: - - if [[ "${ONIGURUMA}" -gt 0 ]]; then export tags="${tags} oniguruma"; CGO_ENABLED=1; fi; go get -v -t -tags "${tags}" ./... + - > + if [[ "${ONIGURUMA}" -gt 0 ]]; then + export tags="${tags} oniguruma"; + export CGO_ENABLED=1; + fi; + - go get -v -t -tags "${tags}" ./... script: - make test-coverage after_success: @@ -43,7 +48,7 @@ jobs: language: scala jdk: oraclejdk8 before_install: - - CGO_ENABLED=1 + - export CGO_ENABLED=1 # mimics exact behavior of 'go_import_path' for non-go build image - export GOPATH=${TRAVIS_HOME}/gopath - mkdir -p ${GOPATH}/src/gopkg.in/src-d/enry.v1 @@ -123,7 +128,7 @@ jobs: language: scala jdk: oraclejdk8 before_install: - - CGO_ENABLED=1 + - export CGO_ENABLED=1 # mimics exact behavior of 'go_import_path' for non-go build image - export GOPATH=${TRAVIS_HOME}/gopath - mkdir -p ${GOPATH}/src/gopkg.in/src-d/enry.v1 From 85d5906b2b6a1cc1139bb0f75b158394a63e6e70 Mon Sep 17 00:00:00 2001 From: Alexander Bezzubov Date: Thu, 11 Apr 2019 21:36:29 +0200 Subject: [PATCH 7/7] address review feedback - tixing a fypo Signed-off-by: Alexander Bezzubov --- internal/code-generator/generator/heuristics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/code-generator/generator/heuristics.go b/internal/code-generator/generator/heuristics.go index 1231c884..67a9c0c5 100644 --- a/internal/code-generator/generator/heuristics.go +++ b/internal/code-generator/generator/heuristics.go @@ -51,7 +51,7 @@ func loadHeuristics(yaml *Heuristics) (map[string][]*LanguagePattern, error) { // unroll to a single map for _, ext := range disambiguation.Extensions { if _, ok := patterns[ext]; ok { - return nil, fmt.Errorf("cannt add extension '%s', it already exists for %+v", ext, patterns[ext]) + return nil, fmt.Errorf("cannot add extension '%s', it already exists for %+v", ext, patterns[ext]) } patterns[ext] = rules }