github.com/octohelm/cuemod@v0.9.4/pkg/cueify/golang/std/list.go (about)

     1  //go:generate sh ./list.sh
     2  package std
     3  
     4  import (
     5  	"bufio"
     6  	"bytes"
     7  	_ "embed"
     8  )
     9  
    10  //go:embed list.txt
    11  var list []byte
    12  
    13  var stds = map[string]bool{}
    14  
    15  func init() {
    16  	scanner := bufio.NewScanner(bytes.NewBuffer(list))
    17  	for scanner.Scan() {
    18  		pkg := scanner.Text()
    19  		if pkg != "" {
    20  			stds[pkg] = true
    21  		}
    22  	}
    23  }
    24  
    25  func IsStd(importPath string) bool {
    26  	if _, ok := stds[importPath]; ok {
    27  		return true
    28  	}
    29  	return false
    30  }