github.com/hedzr/evendeep@v0.4.8/lookup-golang-packages.sh (about)

     1  #!/bin/bash
     2  
     3  ver="1.19.5"
     4  osarch="darwin_amd64"
     5  srcdir="$HOME/go/go$ver/pkg/$osarch"
     6  srcdir="$HOME/go/go$ver/src"
     7  
     8  cat <<"EOT"
     9  package evendeep
    10  
    11  func packageisreserved(packagename string) (shouldIgnored bool) {
    12  	onceinitignoredpackages.Do(func() {
    13  		_ignoredpackageprefixes = ignoredpackageprefixes{
    14  			"github.com/golang",
    15  			"golang.org/",
    16  			"google.golang.org/",
    17  		}
    18  		// the following name list comes with go1.18beta1 src/.
    19  		// Perhaps it would need to be updated in the future.
    20  		_ignoredpackages = ignoredpackages{
    21  EOT
    22  
    23  for p in $(ls -b "$srcdir" | sort); do
    24  	[ -d "$srcdir/$p" ] && printf "			%-15s true,\n" "\"$p\":"
    25  done
    26  
    27  cat <<"EOT"
    28  		}
    29  	})
    30  
    31  	shouldIgnored = packagename != "" && (_ignoredpackages.contains(packagename) ||
    32  		_ignoredpackageprefixes.contains(packagename))
    33  	return
    34  }
    35  EOT