From 74fe213b1574d6fea6f103b5a4201c136336054f Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Wed, 10 Feb 2021 23:23:02 +0100 Subject: [PATCH] builder: remove unused cacheKey parameter This key was intended as some sort of cache key (as the name indicates) but that never happened. Let's remove it to avoid clutter. The cacheLoad and cacheStore functions are only used for C libraries (libc, compiler-rt) so their caching behavior is a bit different from other things worth caching. --- builder/buildcache.go | 9 ++------- builder/library.go | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/builder/buildcache.go b/builder/buildcache.go index 83f077bc..b673de06 100644 --- a/builder/buildcache.go +++ b/builder/buildcache.go @@ -30,10 +30,7 @@ func cacheTimestamp(paths []string) (time.Time, error) { // Try to load a given file from the cache. Return "", nil if no cached file can // be found (or the file is stale), return the absolute path if there is a cache // and return an error on I/O errors. -// -// TODO: the configKey is currently ignored. It is supposed to be used as extra -// data for the cache key, like the compiler version and arguments. -func cacheLoad(name, configKey string, sourceFiles []string) (string, error) { +func cacheLoad(name string, sourceFiles []string) (string, error) { cachepath := filepath.Join(goenv.Get("GOCACHE"), name) cacheStat, err := os.Stat(cachepath) if os.IsNotExist(err) { @@ -58,9 +55,7 @@ func cacheLoad(name, configKey string, sourceFiles []string) (string, error) { // Store the file located at tmppath in the cache with the given name. The // tmppath may or may not be gone afterwards. -// -// Note: the configKey is ignored, see cacheLoad. -func cacheStore(tmppath, name, configKey string, sourceFiles []string) (string, error) { +func cacheStore(tmppath, name string, sourceFiles []string) (string, error) { // get the last modified time if len(sourceFiles) == 0 { panic("cache: no source files") diff --git a/builder/library.go b/builder/library.go index 0c7bb28f..886499d2 100644 --- a/builder/library.go +++ b/builder/library.go @@ -71,7 +71,7 @@ func (l *Library) load(target, tmpdir string) (path string, job *compileJob, err outfile := l.name + "-" + target + ".a" // Try to fetch this library from the cache. - if path, err := cacheLoad(outfile, commands["clang"][0], l.sourcePaths(target)); path != "" || err != nil { + if path, err := cacheLoad(outfile, l.sourcePaths(target)); path != "" || err != nil { // Cache hit. return path, nil, err } @@ -112,7 +112,7 @@ func (l *Library) load(target, tmpdir string) (path string, job *compileJob, err return err } // Store this archive in the cache. - _, err = cacheStore(arpath, outfile, commands["clang"][0], l.sourcePaths(target)) + _, err = cacheStore(arpath, outfile, l.sourcePaths(target)) return err }, }