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 {