Merge pull request #219 from bzz/go-mod

Introduce Go modules
This commit is contained in:
Alexander 2019-04-17 13:39:55 +02:00 committed by GitHub
commit ae43e1a91f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 83 additions and 73 deletions

View File

@ -1,15 +1,15 @@
dist: trusty
language: go
go_import_path: gopkg.in/src-d/enry.v1
go:
- '1.11.6' # specific versions until https://github.com/golang/go/issues/31293
- '1.12.1'
- '1.12.x'
- '1.11.x'
env:
global:
- GO_VERSION_FOR_JVM='1.11.1'
- GO_VERSION_FOR_JVM='1.11.x'
- CGO_ENABLED=0
- GO111MODULE=on
matrix:
- ONIGURUMA=0
- ONIGURUMA=1
@ -32,10 +32,9 @@ stage: test
install:
- >
if [[ "${ONIGURUMA}" -gt 0 ]]; then
export tags="${tags} oniguruma";
export CGO_ENABLED=1;
export GO_TAGS='oniguruma';
fi;
- go get -v -t -tags "${tags}" ./...
script:
- make test-coverage
after_success:
@ -47,19 +46,10 @@ jobs:
stage: test
language: scala
jdk: oraclejdk8
before_install:
- 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
- tar -Pczf ${TRAVIS_TMPDIR}/src_archive.tar.gz -C ${TRAVIS_BUILD_DIR} . && tar -Pxzf ${TRAVIS_TMPDIR}/src_archive.tar.gz -C ${TRAVIS_HOME}/gopath/src/gopkg.in/src-d/enry.v1
- export TRAVIS_BUILD_DIR=${TRAVIS_HOME}/gopath/src/gopkg.in/src-d/enry.v1
- cd ${TRAVIS_HOME}/gopath/src/gopkg.in/src-d/enry.v1
install:
- export CGO_ENABLED=1
- eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=$GO_VERSION_FOR_JVM bash)"
- go version
- echo $PWD; echo $GOPATH
- go get -v ./...
before_script:
- cd java
- make
@ -70,7 +60,6 @@ jobs:
stage: release
install:
- go version
- go get -v -t ./...
script: make packages
deploy:
provider: releases
@ -86,7 +75,6 @@ jobs:
stage: release
install:
- go version
- go get -v -t ./...
script: make linux-shared
deploy:
provider: releases
@ -100,19 +88,17 @@ jobs:
- name: 'macOS shared lib'
stage: release
sudo: true
env:
- OSXCROSS_PACKAGE="osxcross_3034f7149716d815bc473d0a7b35d17e4cf175aa.tar.gz"
- OSXCROSS_URL="https://github.com/bblfsh/client-scala/releases/download/v1.5.2/${OSXCROSS_PACKAGE}"
- PATH="/$HOME/osxcross/bin:$PATH"
install:
- go version
- go get -v -t ./...
- sudo apt-get update
- sudo apt-get install -y --no-install-recommends clang g++ gcc gcc-multilib libc6-dev libc6-dev-i386 mingw-w64 patch xz-utils
- cd ${HOME}
- curl -sfSL ${OSXCROSS_URL} | tar -C ${HOME} -xzf -
- cd $GOPATH/src/gopkg.in/src-d/enry.v1
- cd $GOPATH/src/github.com/src-d/enry
script: make darwin-shared
deploy:
provider: releases
@ -127,18 +113,10 @@ jobs:
stage: publish
language: scala
jdk: oraclejdk8
before_install:
- 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
- tar -Pczf ${TRAVIS_TMPDIR}/src_archive.tar.gz -C ${TRAVIS_BUILD_DIR} . && tar -Pxzf ${TRAVIS_TMPDIR}/src_archive.tar.gz -C ${TRAVIS_HOME}/gopath/src/gopkg.in/src-d/enry.v1
- export TRAVIS_BUILD_DIR=${TRAVIS_HOME}/gopath/src/gopkg.in/src-d/enry.v1
- cd ${TRAVIS_HOME}/gopath/src/gopkg.in/src-d/enry.v1
install:
- export CGO_ENABLED=1
- eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=$GO_VERSION_FOR_JVM bash)"
- go version
- go get -v -t ./...
before_script:
- cd java
- make

View File

@ -1,4 +1,4 @@
# enry [![GoDoc](https://godoc.org/gopkg.in/src-d/enry.v1?status.svg)](https://godoc.org/gopkg.in/src-d/enry.v1) [![Build Status](https://travis-ci.com/src-d/enry.svg?branch=master)](https://travis-ci.com/src-d/enry) [![codecov](https://codecov.io/gh/src-d/enry/branch/master/graph/badge.svg)](https://codecov.io/gh/src-d/enry)
# enry [![GoDoc](https://godoc.org/github.com/src-d/enry?status.svg)](https://godoc.org/github.com/src-d/enry) [![Build Status](https://travis-ci.com/src-d/enry.svg?branch=master)](https://travis-ci.com/src-d/enry) [![codecov](https://codecov.io/gh/src-d/enry/branch/master/graph/badge.svg)](https://codecov.io/gh/src-d/enry)
File programming language detector and toolbox to ignore binary or vendored files. *enry*, started as a port to _Go_ of the original [linguist](https://github.com/github/linguist) _Ruby_ library, that has an improved *2x performance*.
@ -9,7 +9,7 @@ Installation
The recommended way to install enry is
```
go get gopkg.in/src-d/enry.v1/cmd/enry
go get github.com/src-d/enry/cmd/enry
```
To build enry's CLI you must run

View File

@ -10,7 +10,7 @@ import (
"path/filepath"
"testing"
"gopkg.in/src-d/enry.v1/data"
"github.com/src-d/enry/v2/data"
)
type sample struct {

View File

@ -4,7 +4,7 @@ import (
"math"
"sort"
"gopkg.in/src-d/enry.v1/internal/tokenizer"
"github.com/src-d/enry/v2/internal/tokenizer"
)
// Classifier is the interface in charge to detect the possible languages of the given content based on a set of

View File

@ -14,8 +14,8 @@ import (
"sort"
"strings"
"gopkg.in/src-d/enry.v1"
"gopkg.in/src-d/enry.v1/data"
"github.com/src-d/enry/v2"
"github.com/src-d/enry/v2/data"
)
var (

View File

@ -6,8 +6,8 @@ import (
"path/filepath"
"strings"
"gopkg.in/src-d/enry.v1/data"
"gopkg.in/src-d/enry.v1/regex"
"github.com/src-d/enry/v2/data"
"github.com/src-d/enry/v2/regex"
)
// OtherLanguage is used as a zero value when a function can not return a specific language.

View File

@ -8,7 +8,7 @@ import (
"path/filepath"
"testing"
"gopkg.in/src-d/enry.v1/data"
"github.com/src-d/enry/v2/data"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data
@ -6,7 +6,7 @@ package data
import (
"regexp"
"gopkg.in/src-d/enry.v1/data/rule"
"github.com/src-d/enry/v2/data/rule"
)
var ContentHeuristics = map[string]*Heuristics{

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,6 +1,6 @@
package data
import "gopkg.in/src-d/enry.v1/data/rule"
import "github.com/src-d/enry/v2/data/rule"
// Heuristics implements a rule-based content matching engine.

View File

@ -4,8 +4,8 @@ import (
"regexp"
"testing"
"github.com/src-d/enry/v2/data/rule"
"github.com/stretchr/testify/assert"
"gopkg.in/src-d/enry.v1/data/rule"
)
var testContentHeuristics = map[string]*Heuristics{

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -11,6 +11,6 @@
Upstream Linguist YAML files are used to generate datastructures for data
package.
*/
package enry // import "gopkg.in/src-d/enry.v1"
package enry // import "github.com/src-d/enry"
//go:generate make code-generate

11
go.mod Normal file
View File

@ -0,0 +1,11 @@
module github.com/src-d/enry/v2
go 1.12
require (
github.com/src-d/go-oniguruma v1.0.0
github.com/stretchr/testify v1.3.0
github.com/toqueteos/trie v1.0.0 // indirect
gopkg.in/toqueteos/substring.v1 v1.0.2
gopkg.in/yaml.v2 v2.2.2
)

17
go.sum Normal file
View File

@ -0,0 +1,17 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/src-d/go-oniguruma v1.0.0 h1:JDk5PUAjreGsGAKLsoDLNmrsaryjJ5RqT3h+Si6aw/E=
github.com/src-d/go-oniguruma v1.0.0/go.mod h1:chVbff8kcVtmrhxtZ3yBVLLquXbzCS6DrxQaAK/CeqM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/toqueteos/trie v1.0.0 h1:8i6pXxNUXNRAqP246iibb7w/pSFquNTQ+uNfriG7vlk=
github.com/toqueteos/trie v1.0.0/go.mod h1:Ywk48QhEqhU1+DwhMkJ2x7eeGxDHiGkAdc9+0DYcbsM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/toqueteos/substring.v1 v1.0.2 h1:urLqCeMm6x/eTuQa1oZerNw8N1KNOIp5hD5kGL7lFsE=
gopkg.in/toqueteos/substring.v1 v1.0.2/go.mod h1:Eb2Z1UYehlVK8LYW2WBVR2rwbujsz3aX8XDrM1vbNew=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@ -3,7 +3,7 @@ package data
import (
"regexp"
"gopkg.in/src-d/enry.v1/data/rule"
"github.com/src-d/enry/v2/data/rule"
)
var ContentHeuristics = map[string]*Heuristics{

View File

@ -1,3 +1,3 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: {{ getCommit }}

View File

@ -12,7 +12,7 @@ import (
"strconv"
"text/template"
"gopkg.in/src-d/enry.v1/internal/tokenizer"
"github.com/src-d/enry/v2/internal/tokenizer"
)
type samplesFrequencies struct {

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data
@ -6,7 +6,7 @@ package data
import (
"regexp"
"gopkg.in/src-d/enry.v1/data/rule"
"github.com/src-d/enry/v2/data/rule"
)
var ContentHeuristics = map[string]*Heuristics{

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -1,4 +1,4 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: e4560984058b4726010ca4b8f03ed9d0f8f464db
package data

View File

@ -4,7 +4,7 @@ import (
"io/ioutil"
"log"
"gopkg.in/src-d/enry.v1/internal/code-generator/generator"
"github.com/src-d/enry/v2/internal/code-generator/generator"
)
const (

View File

@ -5,7 +5,7 @@ package tokenizer
import (
"bytes"
"gopkg.in/src-d/enry.v1/regex"
"github.com/src-d/enry/v2/regex"
)
// Tokenize returns lexical tokens from content. The tokens returned match what

View File

@ -14,6 +14,10 @@ developers += Developer("abeaumont",
"Alfredo Beaumont",
"alfredo@sourced.tech",
url("https://github.com/abeaumont"))
developers += Developer("bzz",
"Alexander Bezzubov",
"alex@sourced.tech",
url("https://github.com/bzz"))
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))
pomIncludeRepository := (_ => false)

View File

@ -4,7 +4,7 @@
package main
import "C"
import "gopkg.in/src-d/enry.v1"
import "github.com/src-d/enry/v2"
//export GetLanguage
func GetLanguage(filename string, content []byte) string {

View File

@ -5,7 +5,7 @@ import (
"path/filepath"
"strings"
"gopkg.in/src-d/enry.v1/data"
"github.com/src-d/enry/v2/data"
)
const binSniffLen = 8000