From 6a927be4afa627117abfeaebe941254d025cb802 Mon Sep 17 00:00:00 2001 From: David Zukowski Date: Thu, 9 Sep 2021 10:51:43 -0500 Subject: [PATCH] replace math.MaxInt usage This constant is only available in go >= 1.17, so I've inlined its value so dependents don't have to upgrade their go version. reference implementation: https://cs.opensource.google/go/go/+/refs/tags/go1.17:src/math/const.go;l=38 --- pkg/api/api_impl.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/api/api_impl.go b/pkg/api/api_impl.go index 49b627fe710..02b1c06b6e3 100644 --- a/pkg/api/api_impl.go +++ b/pkg/api/api_impl.go @@ -3,7 +3,6 @@ package api import ( "fmt" "io/ioutil" - "math" "math/rand" "os" "regexp" @@ -31,6 +30,11 @@ import ( "github.com/evanw/esbuild/internal/resolver" ) +const ( + intSize = 32 << (^uint(0) >> 63) + maxInt = 1<<(intSize-1) - 1 +) + func validatePathTemplate(template string) []config.PathTemplate { if template == "" { return nil @@ -1755,7 +1759,7 @@ func analyzeMetafileImpl(metafile string, opts AnalyzeMetafileOptions) string { for _, importPath := range importsForPath[top].imports { imported, ok := graph[importPath] if !ok { - imported.depth = math.MaxInt + imported.depth = maxInt } if imported.depth > childDepth {