diff --git a/.travis.yml b/.travis.yml index 5232216..4776cd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,10 @@ language: go go: -- '1.2.x' -- '1.3.x' -- '1.4.x' -- '1.5.x' -- '1.6.x' -- '1.7.x' -- '1.8.x' -- '1.9.x' -- '1.10.x' -- '1.11.x' -- 'tip' + - '1.11.x' + - '1.12.x' + - 'tip' sudo: true before_install: -- ./travis-mecab-install.sh -- export CGO_LDFLAGS="`mecab-config --libs`" -- export CGO_CFLAGS="-I`mecab-config --inc-dir`" + - ./travis-mecab-install.sh + - export CGO_LDFLAGS="`mecab-config --libs`" + - export CGO_CFLAGS="-I`mecab-config --inc-dir`" diff --git a/go.mod b/go.mod index 9f39e6e..7667a7c 100644 --- a/go.mod +++ b/go.mod @@ -1 +1,3 @@ module github.com/shogo82148/go-mecab + +go 1.12 diff --git a/mecab.go b/mecab.go index 44e470f..36e64a3 100644 --- a/mecab.go +++ b/mecab.go @@ -9,6 +9,7 @@ import ( "fmt" "reflect" "unsafe" + "runtime" ) // MeCab is a morphological parser. @@ -67,6 +68,7 @@ func (m MeCab) Parse(s string) (string, error) { if result == nil { return "", m.Error() } + runtime.KeepAlive(s) return C.GoString(result), nil } @@ -96,6 +98,7 @@ func (m MeCab) ParseToNode(s string) (Node, error) { if node == nil { return Node{}, m.Error() } + runtime.KeepAlive(s) return Node{node: node}, nil }