Skip to content

Commit 96af958

Browse files
committed
fix #383: eval symlinks in AST cache
1 parent 307c287 commit 96af958

File tree

3 files changed

+60
-25
lines changed

3 files changed

+60
-25
lines changed

README.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -937,18 +937,30 @@ Thanks to developers and authors of used linters:
937937
Follow the news and releases on our [twitter](https://twitter.com/golangci) and our [blog](https://medium.com/golangci).
938938
There is the most valuable changes log:
939939
940+
### February 2019
941+
1. Implement auto-fixing for `gofmt`, `goimports` and `misspell`
942+
2. Update `unparam`, `goimports`, `gosec` and `go-critic`
943+
3. Support `issues.exclude-rules` config option
944+
4. Add more `identifier` marking patterns
945+
5. Add code-climate output format
946+
6. Fix diff parsing on windows
947+
7. Add version information to built artifact for go1.12
948+
8. Dockerfile: copy the binary to `/usr/bin/` instead of `$GOPATH/bin/`
949+
9. Support `ignore-words` config option for `misspell`
950+
10. Include `staticcheck` check name into a message
951+
940952
### January 2019
941953
942-
1. Update `megacheck` (`staticcheck`) to the latest version: it consumes much less memory.
954+
1. Update `megacheck` (`staticcheck`), `unparam` and `go-critic` to the latest versions.
943955
2. Support the new `stylecheck` linter.
944-
3. Update `go-critic` to the latest version.
945-
4. Support of `enabled-tags` options for `go-critic`.
946-
5. Make rich debugging for `go-critic` and meticulously validate `go-critic` checks config.
947-
6. Update and use upstream versions of `unparam` and `interfacer` instead of forked ones.
948-
7. Improve handling of unknown linter names in `//nolint` directives.
949-
8. Speedup `typecheck` on large project with compilation errors.
950-
9. Add support for searching for `errcheck` exclude file.
951-
10. Fix `go-misc` checksum.
956+
3. Support of `enabled-tags` options for `go-critic`.
957+
4. Make rich debugging for `go-critic` and meticulously validate `go-critic` checks config.
958+
5. Update and use upstream versions of `unparam` and `interfacer` instead of forked ones.
959+
6. Improve handling of unknown linter names in `//nolint` directives.
960+
7. Speedup `typecheck` on large project with compilation errors.
961+
8. Add support for searching for `errcheck` exclude file.
962+
9. Fix `go-misc` checksum.
963+
10. Don't crash when staticcheck panics
952964
953965
### December 2018
954966

README.tmpl.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -481,18 +481,30 @@ Thanks to developers and authors of used linters:
481481
Follow the news and releases on our [twitter](https://twitter.com/golangci) and our [blog](https://medium.com/golangci).
482482
There is the most valuable changes log:
483483

484+
### February 2019
485+
1. Implement auto-fixing for `gofmt`, `goimports` and `misspell`
486+
2. Update `unparam`, `goimports`, `gosec` and `go-critic`
487+
3. Support `issues.exclude-rules` config option
488+
4. Add more `identifier` marking patterns
489+
5. Add code-climate output format
490+
6. Fix diff parsing on windows
491+
7. Add version information to built artifact for go1.12
492+
8. Dockerfile: copy the binary to `/usr/bin/` instead of `$GOPATH/bin/`
493+
9. Support `ignore-words` config option for `misspell`
494+
10. Include `staticcheck` check name into a message
495+
484496
### January 2019
485497

486-
1. Update `megacheck` (`staticcheck`) to the latest version: it consumes much less memory.
498+
1. Update `megacheck` (`staticcheck`), `unparam` and `go-critic` to the latest versions.
487499
2. Support the new `stylecheck` linter.
488-
3. Update `go-critic` to the latest version.
489-
4. Support of `enabled-tags` options for `go-critic`.
490-
5. Make rich debugging for `go-critic` and meticulously validate `go-critic` checks config.
491-
6. Update and use upstream versions of `unparam` and `interfacer` instead of forked ones.
492-
7. Improve handling of unknown linter names in `//nolint` directives.
493-
8. Speedup `typecheck` on large project with compilation errors.
494-
9. Add support for searching for `errcheck` exclude file.
495-
10. Fix `go-misc` checksum.
500+
3. Support of `enabled-tags` options for `go-critic`.
501+
4. Make rich debugging for `go-critic` and meticulously validate `go-critic` checks config.
502+
5. Update and use upstream versions of `unparam` and `interfacer` instead of forked ones.
503+
6. Improve handling of unknown linter names in `//nolint` directives.
504+
7. Speedup `typecheck` on large project with compilation errors.
505+
8. Add support for searching for `errcheck` exclude file.
506+
9. Fix `go-misc` checksum.
507+
10. Don't crash when staticcheck panics
496508

497509
### December 2018
498510

pkg/lint/astcache/astcache.go

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
"golang.org/x/tools/go/packages"
1111

12+
"github.com/golangci/golangci-lint/pkg/fsutils"
1213
"github.com/golangci/golangci-lint/pkg/logutils"
1314
)
1415

@@ -41,17 +42,27 @@ func (c Cache) ParsedFilenames() []string {
4142
}
4243

4344
func (c Cache) normalizeFilename(filename string) string {
44-
if filepath.IsAbs(filename) {
45-
return filepath.Clean(filename)
46-
}
45+
absPath := func() string {
46+
if filepath.IsAbs(filename) {
47+
return filepath.Clean(filename)
48+
}
49+
50+
absFilename, err := filepath.Abs(filename)
51+
if err != nil {
52+
c.log.Warnf("Can't abs-ify filename %s: %s", filename, err)
53+
return filename
54+
}
55+
56+
return absFilename
57+
}()
4758

48-
absFilename, err := filepath.Abs(filename)
59+
ret, err := fsutils.EvalSymlinks(absPath)
4960
if err != nil {
50-
c.log.Warnf("Can't abs-ify filename %s: %s", filename, err)
51-
return filename
61+
c.log.Warnf("Failed to eval symlinks for %s: %s", absPath, err)
62+
return absPath
5263
}
5364

54-
return absFilename
65+
return ret
5566
}
5667

5768
func (c Cache) Get(filename string) *File {

0 commit comments

Comments
 (0)