From 7514bf823931b8c777a68ba7a7af8e5217fff191 Mon Sep 17 00:00:00 2001 From: Trevor Pounds Date: Mon, 4 Mar 2019 17:21:43 -0500 Subject: [PATCH] Fix AST cache key consistency. Ensures the AST cache always consistently loads/stores by using the normalized file path as the key. --- pkg/lint/astcache/astcache.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/lint/astcache/astcache.go b/pkg/lint/astcache/astcache.go index 35f11d00..fffe9eca 100644 --- a/pkg/lint/astcache/astcache.go +++ b/pkg/lint/astcache/astcache.go @@ -129,10 +129,12 @@ func (c *Cache) loadFromPackage(pkg *packages.Package) { continue } - c.m[pos.Filename] = &File{ + filePath := c.normalizeFilename(pos.Filename) + + c.m[filePath] = &File{ F: f, Fset: pkg.Fset, - Name: pos.Filename, + Name: filePath, } } }