Skip to content

Commit d02ac24

Browse files
committed
disable go1.11 in travis and make some small fixes for go1.11
1 parent 3a806e9 commit d02ac24

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ language: go
33
go:
44
- 1.9.x
55
- 1.10.x
6-
- 1.11beta2
6+
# - 1.11beta2 - https://github.com/golang/go/issues/26671
77
script: make check_generated test
88

99
after_success:
@@ -22,4 +22,5 @@ deploy:
2222
tags: true
2323
# it's important to build on the newest version of go:
2424
# - go1.11 type checking properly supports _wasm.go file, without that golangci-lint won't compile program with go 1.11 env
25-
condition: $TRAVIS_GO_VERSION =~ ^1\.11
25+
# but currently go1.11 has bugs, so we build on go1.10
26+
condition: $TRAVIS_GO_VERSION =~ ^1\.10\.

pkg/lint/astcache/astcache.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,21 @@ func LoadFromProgram(prog *loader.Program, log logutils.Log) (*Cache, error) {
7777
continue
7878
}
7979

80-
relPath, err := filepath.Rel(root, pos.Filename)
81-
if err != nil {
82-
c.log.Warnf("Can't get relative path for %s and %s: %s",
83-
root, pos.Filename, err)
84-
continue
80+
path := pos.Filename
81+
if filepath.IsAbs(path) {
82+
relPath, err := filepath.Rel(root, pos.Filename)
83+
if err != nil {
84+
c.log.Warnf("Can't get relative path for %s and %s: %s",
85+
root, pos.Filename, err)
86+
continue
87+
}
88+
path = relPath
8589
}
8690

87-
c.m[relPath] = &File{
91+
c.m[path] = &File{
8892
F: f,
8993
Fset: prog.Fset,
90-
Name: relPath,
94+
Name: path,
9195
}
9296
}
9397
}

pkg/result/processors/autogenerated_exclude.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,11 @@ func getDoc(f *ast.File, fset *token.FileSet, filePath string) string {
117117
filePos := fset.Position(pos)
118118
text := g.Text()
119119

120-
// files using cgo have implicitly added comment "Created by cgo - DO NOT EDIT"
121-
isAllowed := pos < importPos && filePos.Column == 1 && !strings.Contains(text, "Created by cgo")
120+
// files using cgo have implicitly added comment "Created by cgo - DO NOT EDIT" for go <= 1.10
121+
// and "Code generated by cmd/cgo" for go >= 1.11
122+
isCgoGenerated := strings.Contains(text, "Created by cgo") || strings.Contains(text, "Code generated by cmd/cgo")
123+
124+
isAllowed := pos < importPos && filePos.Column == 1 && !isCgoGenerated
122125
if isAllowed {
123126
autogenDebugf("file %q: pos=%d, filePos=%s: comment %q: it's allowed", filePath, pos, filePos, text)
124127
neededComments = append(neededComments, text)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// args: -Etypecheck
22
package testdata
33

4-
fun NotCompiles() { // ERROR "expected declaration, found 'IDENT' fun"
4+
fun NotCompiles() { // ERROR "expected declaration, found.* fun"
55
}

0 commit comments

Comments
 (0)