...

Source file src/pkg/internal/goroot/gccgo.go

     1	// Copyright 2018 The Go Authors. All rights reserved.
     2	// Use of this source code is governed by a BSD-style
     3	// license that can be found in the LICENSE file.
     4	
     5	// +build gccgo
     6	
     7	package goroot
     8	
     9	import (
    10		"os"
    11		"path/filepath"
    12	)
    13	
    14	// IsStandardPackage reports whether path is a standard package,
    15	// given goroot and compiler.
    16	func IsStandardPackage(goroot, compiler, path string) bool {
    17		switch compiler {
    18		case "gc":
    19			dir := filepath.Join(goroot, "src", path)
    20			_, err := os.Stat(dir)
    21			return err == nil
    22		case "gccgo":
    23			return stdpkg[path]
    24		default:
    25			panic("unknown compiler " + compiler)
    26		}
    27	}
    28	

View as plain text