Source File
license.go
Belonging Package
github.com/google/licensecheck
package licensecheck
import (
)
Unrestricted Type = 1 << iota
func ( Type) ( Type) Type {
if == Unknown || == Unknown {
return Unknown
}
var Type
for := ShareServer; > 0; >>= 1 {
if (|)& != 0 {
|=
break
}
}
|= ( | ) & (NonCommercial | Discouraged)
if &Unrestricted != 0 && &NonCommercial != 0 {
&^= Unrestricted
}
return
}
var typeBits = []struct {
t Type
s string
}{
{Unknown, "Unknown"},
{Unrestricted, "Unrestricted"},
{Notice, "Notice"},
{ShareChanges, "ShareChanges"},
{ShareProgram, "ShareProgram"},
{ShareServer, "ShareServer"},
{NonCommercial, "NonCommercial"},
{Discouraged, "Discouraged"},
}
func ( string) (Type, error) {
var Type
:
for , := range strings.Split(, "|") {
for , := range typeBits {
if .s == {
|= .t
continue
}
}
if strings.HasPrefix(, "Type(") && strings.HasSuffix(, ")") {
if , := strconv.ParseUint([5:len()-1], 0, 0); == nil {
|= Type()
continue
}
}
if == "" {
return 0, fmt.Errorf("parsing %q: malformed Type", )
}
return 0, fmt.Errorf("parsing %q: unknown Type %q", , )
}
return , nil
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |