src-d / enry

A faster file programming language detector
https://blog.sourced.tech/post/enry/
Apache License 2.0
460 stars 51 forks source link

Introduce Go modules #219

Closed bzz closed 5 years ago

bzz commented 5 years ago

This fixes #170 by adding Modules support.

bzz commented 5 years ago
$ go test all

# github.com/src-d/enry/internal/code-generator/generator
internal/code-generator/generator/heuristics.go:54:17: Errorf format %q has arg patterns[ext] of wrong type []*github.com/src-d/enry/internal/code-generator/generator.LanguagePattern

FAIL    github.com/src-d/enry/internal/code-generator/generator [build failed]

--- FAIL: TestCrashDumpsAllThreads (0.03s)
    crash_unix_test.go:70: building source: exit status 1
        go: cannot find main module; see 'go help modules'
FAIL
FAIL    runtime 161.287s

Although these are not sorted out yet, early feedback is very appreciated!

bzz commented 5 years ago

The only failure on go test all is now a

--- FAIL: TestCrashDumpsAllThreads (0.04s)
    crash_unix_test.go:70: building source: exit status 1
        go: cannot find main module; see 'go help modules'
FAIL
FAIL    runtime 162.087s

which does not seem relevant.

One last thing left is - fix a CGO profiles on CI that seems to fail due to what seems to be some compiler/linker version missmatch

# github.com/src-d/enry.test
/home/travis/.gimme/versions/go1.12.3.linux.amd64/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: /tmp/go-link-029942625/000006.o: unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
creachadair commented 5 years ago

which does not seem relevant.

It looks relevant to me—the error is from a module-aware build, not being able to identify the main module. It is probably a configuration issue rather than a code bug, though. This is typical of what you get if either (a) you build inside $GOPATH with modules not enabled (e.g., Go 1.11.x without GO111MODULE=on), or (b) you build outside $GOPATH with no go.mod file in $PWD.

bzz commented 5 years ago

CI is going to be fixed on master in separate PR #221. Scope in this PR's description was updated to include last module-related test failure instead.

bzz commented 5 years ago

Needs to be rebased on master, after #222 lands:

bzz commented 5 years ago

As discussed, consensus is that go test all failures in third-party dependencies might happen but do not block this work as soon as our tests pass.

Looking into code generator test fail with \w oniguruma:

$ go test -tags 'oniguruma' ./internal/code-generator/... -run Test_GeneratorTestSuite -testify.m TestGenerationFiles
bzz commented 5 years ago

CI fails due to https://github.com/src-d/enry/issues/225 that should be investigated and fixed in a separate profile.

This is ready to be merged as soon as /v2 is added!

bzz commented 5 years ago

This is ready to be merged now - v2 was added in 6a5f37e

CI will be taken care of under https://github.com/src-d/enry/issues/225 before v2.0.0 release