id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
28,800
godbus/dbus
call.go
Store
func (c *Call) Store(retvalues ...interface{}) error { if c.Err != nil { return c.Err } return Store(c.Body, retvalues...) }
go
func (c *Call) Store(retvalues ...interface{}) error { if c.Err != nil { return c.Err } return Store(c.Body, retvalues...) }
[ "func", "(", "c", "*", "Call", ")", "Store", "(", "retvalues", "...", "interface", "{", "}", ")", "error", "{", "if", "c", ".", "Err", "!=", "nil", "{", "return", "c", ".", "Err", "\n", "}", "\n\n", "return", "Store", "(", "c", ".", "Body", ","...
// Store stores the body of the reply into the provided pointers. It returns // an error if the signatures of the body and retvalues don't match, or if // the error status is not nil.
[ "Store", "stores", "the", "body", "of", "the", "reply", "into", "the", "provided", "pointers", ".", "It", "returns", "an", "error", "if", "the", "signatures", "of", "the", "body", "and", "retvalues", "don", "t", "match", "or", "if", "the", "error", "stat...
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/call.go#L49-L55
28,801
godbus/dbus
dbus.go
Store
func Store(src []interface{}, dest ...interface{}) error { if len(src) != len(dest) { return errors.New("dbus.Store: length mismatch") } for i := range src { if err := storeInterfaces(src[i], dest[i]); err != nil { return err } } return nil }
go
func Store(src []interface{}, dest ...interface{}) error { if len(src) != len(dest) { return errors.New("dbus.Store: length mismatch") } for i := range src { if err := storeInterfaces(src[i], dest[i]); err != nil { return err } } return nil }
[ "func", "Store", "(", "src", "[", "]", "interface", "{", "}", ",", "dest", "...", "interface", "{", "}", ")", "error", "{", "if", "len", "(", "src", ")", "!=", "len", "(", "dest", ")", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", ...
// Store copies the values contained in src to dest, which must be a slice of // pointers. It converts slices of interfaces from src to corresponding structs // in dest. An error is returned if the lengths of src and dest or the types of // their elements don't match.
[ "Store", "copies", "the", "values", "contained", "in", "src", "to", "dest", "which", "must", "be", "a", "slice", "of", "pointers", ".", "It", "converts", "slices", "of", "interfaces", "from", "src", "to", "corresponding", "structs", "in", "dest", ".", "An"...
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/dbus.go#L47-L58
28,802
godbus/dbus
dbus.go
IsValid
func (o ObjectPath) IsValid() bool { s := string(o) if len(s) == 0 { return false } if s[0] != '/' { return false } if s[len(s)-1] == '/' && len(s) != 1 { return false } // probably not used, but technically possible if s == "/" { return true } split := strings.Split(s[1:], "/") for _, v := range sp...
go
func (o ObjectPath) IsValid() bool { s := string(o) if len(s) == 0 { return false } if s[0] != '/' { return false } if s[len(s)-1] == '/' && len(s) != 1 { return false } // probably not used, but technically possible if s == "/" { return true } split := strings.Split(s[1:], "/") for _, v := range sp...
[ "func", "(", "o", "ObjectPath", ")", "IsValid", "(", ")", "bool", "{", "s", ":=", "string", "(", "o", ")", "\n", "if", "len", "(", "s", ")", "==", "0", "{", "return", "false", "\n", "}", "\n", "if", "s", "[", "0", "]", "!=", "'/'", "{", "re...
// IsValid returns whether the object path is valid.
[ "IsValid", "returns", "whether", "the", "object", "path", "is", "valid", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/dbus.go#L304-L331
28,803
godbus/dbus
dbus.go
alignment
func alignment(t reflect.Type) int { switch t { case variantType: return 1 case objectPathType: return 4 case signatureType: return 1 case interfacesType: return 4 } switch t.Kind() { case reflect.Uint8: return 1 case reflect.Uint16, reflect.Int16: return 2 case reflect.Uint, reflect.Int, reflect....
go
func alignment(t reflect.Type) int { switch t { case variantType: return 1 case objectPathType: return 4 case signatureType: return 1 case interfacesType: return 4 } switch t.Kind() { case reflect.Uint8: return 1 case reflect.Uint16, reflect.Int16: return 2 case reflect.Uint, reflect.Int, reflect....
[ "func", "alignment", "(", "t", "reflect", ".", "Type", ")", "int", "{", "switch", "t", "{", "case", "variantType", ":", "return", "1", "\n", "case", "objectPathType", ":", "return", "4", "\n", "case", "signatureType", ":", "return", "1", "\n", "case", ...
// alignment returns the alignment of values of type t.
[ "alignment", "returns", "the", "alignment", "of", "values", "of", "type", "t", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/dbus.go#L341-L365
28,804
godbus/dbus
dbus.go
isKeyType
func isKeyType(t reflect.Type) bool { switch t.Kind() { case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Float64, reflect.String, reflect.Uint, reflect.Int: return true } return false }
go
func isKeyType(t reflect.Type) bool { switch t.Kind() { case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Float64, reflect.String, reflect.Uint, reflect.Int: return true } return false }
[ "func", "isKeyType", "(", "t", "reflect", ".", "Type", ")", "bool", "{", "switch", "t", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Uint8", ",", "reflect", ".", "Uint16", ",", "reflect", ".", "Uint32", ",", "reflect", ".", "Uint64", ",", "...
// isKeyType returns whether t is a valid type for a D-Bus dict.
[ "isKeyType", "returns", "whether", "t", "is", "a", "valid", "type", "for", "a", "D", "-", "Bus", "dict", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/dbus.go#L368-L377
28,805
godbus/dbus
dbus.go
isValidInterface
func isValidInterface(s string) bool { if len(s) == 0 || len(s) > 255 || s[0] == '.' { return false } elem := strings.Split(s, ".") if len(elem) < 2 { return false } for _, v := range elem { if len(v) == 0 { return false } if v[0] >= '0' && v[0] <= '9' { return false } for _, c := range v { ...
go
func isValidInterface(s string) bool { if len(s) == 0 || len(s) > 255 || s[0] == '.' { return false } elem := strings.Split(s, ".") if len(elem) < 2 { return false } for _, v := range elem { if len(v) == 0 { return false } if v[0] >= '0' && v[0] <= '9' { return false } for _, c := range v { ...
[ "func", "isValidInterface", "(", "s", "string", ")", "bool", "{", "if", "len", "(", "s", ")", "==", "0", "||", "len", "(", "s", ")", ">", "255", "||", "s", "[", "0", "]", "==", "'.'", "{", "return", "false", "\n", "}", "\n", "elem", ":=", "st...
// isValidInterface returns whether s is a valid name for an interface.
[ "isValidInterface", "returns", "whether", "s", "is", "a", "valid", "name", "for", "an", "interface", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/dbus.go#L380-L402
28,806
godbus/dbus
dbus.go
isValidMember
func isValidMember(s string) bool { if len(s) == 0 || len(s) > 255 { return false } i := strings.Index(s, ".") if i != -1 { return false } if s[0] >= '0' && s[0] <= '9' { return false } for _, c := range s { if !isMemberChar(c) { return false } } return true }
go
func isValidMember(s string) bool { if len(s) == 0 || len(s) > 255 { return false } i := strings.Index(s, ".") if i != -1 { return false } if s[0] >= '0' && s[0] <= '9' { return false } for _, c := range s { if !isMemberChar(c) { return false } } return true }
[ "func", "isValidMember", "(", "s", "string", ")", "bool", "{", "if", "len", "(", "s", ")", "==", "0", "||", "len", "(", "s", ")", ">", "255", "{", "return", "false", "\n", "}", "\n", "i", ":=", "strings", ".", "Index", "(", "s", ",", "\"", "\...
// isValidMember returns whether s is a valid name for a member.
[ "isValidMember", "returns", "whether", "s", "is", "a", "valid", "name", "for", "a", "member", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/dbus.go#L405-L422
28,807
godbus/dbus
conn.go
SessionBus
func SessionBus() (conn *Conn, err error) { sessionBusLck.Lock() defer sessionBusLck.Unlock() if sessionBus != nil { return sessionBus, nil } defer func() { if conn != nil { sessionBus = conn } }() conn, err = SessionBusPrivate() if err != nil { return } if err = conn.Auth(nil); err != nil { conn...
go
func SessionBus() (conn *Conn, err error) { sessionBusLck.Lock() defer sessionBusLck.Unlock() if sessionBus != nil { return sessionBus, nil } defer func() { if conn != nil { sessionBus = conn } }() conn, err = SessionBusPrivate() if err != nil { return } if err = conn.Auth(nil); err != nil { conn...
[ "func", "SessionBus", "(", ")", "(", "conn", "*", "Conn", ",", "err", "error", ")", "{", "sessionBusLck", ".", "Lock", "(", ")", "\n", "defer", "sessionBusLck", ".", "Unlock", "(", ")", "\n", "if", "sessionBus", "!=", "nil", "{", "return", "sessionBus"...
// SessionBus returns a shared connection to the session bus, connecting to it // if not already done.
[ "SessionBus", "returns", "a", "shared", "connection", "to", "the", "session", "bus", "connecting", "to", "it", "if", "not", "already", "done", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/conn.go#L52-L77
28,808
godbus/dbus
conn.go
SystemBus
func SystemBus() (conn *Conn, err error) { systemBusLck.Lock() defer systemBusLck.Unlock() if systemBus != nil { return systemBus, nil } defer func() { if conn != nil { systemBus = conn } }() conn, err = SystemBusPrivate() if err != nil { return } if err = conn.Auth(nil); err != nil { conn.Close(...
go
func SystemBus() (conn *Conn, err error) { systemBusLck.Lock() defer systemBusLck.Unlock() if systemBus != nil { return systemBus, nil } defer func() { if conn != nil { systemBus = conn } }() conn, err = SystemBusPrivate() if err != nil { return } if err = conn.Auth(nil); err != nil { conn.Close(...
[ "func", "SystemBus", "(", ")", "(", "conn", "*", "Conn", ",", "err", "error", ")", "{", "systemBusLck", ".", "Lock", "(", ")", "\n", "defer", "systemBusLck", ".", "Unlock", "(", ")", "\n", "if", "systemBus", "!=", "nil", "{", "return", "systemBus", "...
// SystemBus returns a shared connection to the system bus, connecting to it if // not already done.
[ "SystemBus", "returns", "a", "shared", "connection", "to", "the", "system", "bus", "connecting", "to", "it", "if", "not", "already", "done", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/conn.go#L109-L134
28,809
godbus/dbus
conn.go
WithHandler
func WithHandler(handler Handler) ConnOption { return func(conn *Conn) error { conn.handler = handler return nil } }
go
func WithHandler(handler Handler) ConnOption { return func(conn *Conn) error { conn.handler = handler return nil } }
[ "func", "WithHandler", "(", "handler", "Handler", ")", "ConnOption", "{", "return", "func", "(", "conn", "*", "Conn", ")", "error", "{", "conn", ".", "handler", "=", "handler", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithHandler overrides the default handler.
[ "WithHandler", "overrides", "the", "default", "handler", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/conn.go#L170-L175
28,810
godbus/dbus
conn.go
WithSignalHandler
func WithSignalHandler(handler SignalHandler) ConnOption { return func(conn *Conn) error { conn.signalHandler = handler return nil } }
go
func WithSignalHandler(handler SignalHandler) ConnOption { return func(conn *Conn) error { conn.signalHandler = handler return nil } }
[ "func", "WithSignalHandler", "(", "handler", "SignalHandler", ")", "ConnOption", "{", "return", "func", "(", "conn", "*", "Conn", ")", "error", "{", "conn", ".", "signalHandler", "=", "handler", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithSignalHandler overrides the default signal handler.
[ "WithSignalHandler", "overrides", "the", "default", "signal", "handler", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/conn.go#L178-L183
28,811
godbus/dbus
conn.go
WithSerialGenerator
func WithSerialGenerator(gen SerialGenerator) ConnOption { return func(conn *Conn) error { conn.serialGen = gen return nil } }
go
func WithSerialGenerator(gen SerialGenerator) ConnOption { return func(conn *Conn) error { conn.serialGen = gen return nil } }
[ "func", "WithSerialGenerator", "(", "gen", "SerialGenerator", ")", "ConnOption", "{", "return", "func", "(", "conn", "*", "Conn", ")", "error", "{", "conn", ".", "serialGen", "=", "gen", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithSerialGenerator overrides the default signals generator.
[ "WithSerialGenerator", "overrides", "the", "default", "signals", "generator", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/conn.go#L186-L191
28,812
godbus/dbus
conn.go
Eavesdrop
func (conn *Conn) Eavesdrop(ch chan<- *Message) { conn.eavesdroppedLck.Lock() conn.eavesdropped = ch conn.eavesdroppedLck.Unlock() }
go
func (conn *Conn) Eavesdrop(ch chan<- *Message) { conn.eavesdroppedLck.Lock() conn.eavesdropped = ch conn.eavesdroppedLck.Unlock() }
[ "func", "(", "conn", "*", "Conn", ")", "Eavesdrop", "(", "ch", "chan", "<-", "*", "Message", ")", "{", "conn", ".", "eavesdroppedLck", ".", "Lock", "(", ")", "\n", "conn", ".", "eavesdropped", "=", "ch", "\n", "conn", ".", "eavesdroppedLck", ".", "Un...
// Eavesdrop causes conn to send all incoming messages to the given channel // without further processing. Method replies, errors and signals will not be // sent to the appropiate channels and method calls will not be handled. If nil // is passed, the normal behaviour is restored. // // The caller has to make sure that...
[ "Eavesdrop", "causes", "conn", "to", "send", "all", "incoming", "messages", "to", "the", "given", "channel", "without", "further", "processing", ".", "Method", "replies", "errors", "and", "signals", "will", "not", "be", "sent", "to", "the", "appropiate", "chan...
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/conn.go#L266-L270
28,813
godbus/dbus
conn.go
SendWithContext
func (conn *Conn) SendWithContext(ctx context.Context, msg *Message, ch chan *Call) *Call { return conn.send(ctx, msg, ch) }
go
func (conn *Conn) SendWithContext(ctx context.Context, msg *Message, ch chan *Call) *Call { return conn.send(ctx, msg, ch) }
[ "func", "(", "conn", "*", "Conn", ")", "SendWithContext", "(", "ctx", "context", ".", "Context", ",", "msg", "*", "Message", ",", "ch", "chan", "*", "Call", ")", "*", "Call", "{", "return", "conn", ".", "send", "(", "ctx", ",", "msg", ",", "ch", ...
// SendWithContext acts like Send but takes a context
[ "SendWithContext", "acts", "like", "Send", "but", "takes", "a", "context" ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/conn.go#L411-L413
28,814
godbus/dbus
conn.go
sendReply
func (conn *Conn) sendReply(dest string, serial uint32, values ...interface{}) { msg := new(Message) msg.Type = TypeMethodReply msg.serial = conn.getSerial() msg.Headers = make(map[HeaderField]Variant) if dest != "" { msg.Headers[FieldDestination] = MakeVariant(dest) } msg.Headers[FieldReplySerial] = MakeVaria...
go
func (conn *Conn) sendReply(dest string, serial uint32, values ...interface{}) { msg := new(Message) msg.Type = TypeMethodReply msg.serial = conn.getSerial() msg.Headers = make(map[HeaderField]Variant) if dest != "" { msg.Headers[FieldDestination] = MakeVariant(dest) } msg.Headers[FieldReplySerial] = MakeVaria...
[ "func", "(", "conn", "*", "Conn", ")", "sendReply", "(", "dest", "string", ",", "serial", "uint32", ",", "values", "...", "interface", "{", "}", ")", "{", "msg", ":=", "new", "(", "Message", ")", "\n", "msg", ".", "Type", "=", "TypeMethodReply", "\n"...
// sendReply creates a method reply message corresponding to the parameters and // sends it to conn.out.
[ "sendReply", "creates", "a", "method", "reply", "message", "corresponding", "to", "the", "parameters", "and", "sends", "it", "to", "conn", ".", "out", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/conn.go#L491-L505
28,815
godbus/dbus
conn.go
Signal
func (conn *Conn) Signal(ch chan<- *Signal) { conn.defaultSignalAction((*defaultSignalHandler).addSignal, ch) }
go
func (conn *Conn) Signal(ch chan<- *Signal) { conn.defaultSignalAction((*defaultSignalHandler).addSignal, ch) }
[ "func", "(", "conn", "*", "Conn", ")", "Signal", "(", "ch", "chan", "<-", "*", "Signal", ")", "{", "conn", ".", "defaultSignalAction", "(", "(", "*", "defaultSignalHandler", ")", ".", "addSignal", ",", "ch", ")", "\n", "}" ]
// Signal registers the given channel to be passed all received signal messages. // The caller has to make sure that ch is sufficiently buffered; if a message // arrives when a write to c is not possible, it is discarded. // // Multiple of these channels can be registered at the same time. // // These channels are "ove...
[ "Signal", "registers", "the", "given", "channel", "to", "be", "passed", "all", "received", "signal", "messages", ".", "The", "caller", "has", "to", "make", "sure", "that", "ch", "is", "sufficiently", "buffered", ";", "if", "a", "message", "arrives", "when", ...
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/conn.go#L524-L526
28,816
godbus/dbus
conn.go
RemoveSignal
func (conn *Conn) RemoveSignal(ch chan<- *Signal) { conn.defaultSignalAction((*defaultSignalHandler).removeSignal, ch) }
go
func (conn *Conn) RemoveSignal(ch chan<- *Signal) { conn.defaultSignalAction((*defaultSignalHandler).removeSignal, ch) }
[ "func", "(", "conn", "*", "Conn", ")", "RemoveSignal", "(", "ch", "chan", "<-", "*", "Signal", ")", "{", "conn", ".", "defaultSignalAction", "(", "(", "*", "defaultSignalHandler", ")", ".", "removeSignal", ",", "ch", ")", "\n", "}" ]
// RemoveSignal removes the given channel from the list of the registered channels.
[ "RemoveSignal", "removes", "the", "given", "channel", "from", "the", "list", "of", "the", "registered", "channels", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/conn.go#L529-L531
28,817
godbus/dbus
conn.go
dereferenceAll
func dereferenceAll(vs []interface{}) []interface{} { for i := range vs { v := reflect.ValueOf(vs[i]) v = v.Elem() vs[i] = v.Interface() } return vs }
go
func dereferenceAll(vs []interface{}) []interface{} { for i := range vs { v := reflect.ValueOf(vs[i]) v = v.Elem() vs[i] = v.Interface() } return vs }
[ "func", "dereferenceAll", "(", "vs", "[", "]", "interface", "{", "}", ")", "[", "]", "interface", "{", "}", "{", "for", "i", ":=", "range", "vs", "{", "v", ":=", "reflect", ".", "ValueOf", "(", "vs", "[", "i", "]", ")", "\n", "v", "=", "v", "...
// dereferenceAll returns a slice that, assuming that vs is a slice of pointers // of arbitrary types, containes the values that are obtained from dereferencing // all elements in vs.
[ "dereferenceAll", "returns", "a", "slice", "that", "assuming", "that", "vs", "is", "a", "slice", "of", "pointers", "of", "arbitrary", "types", "containes", "the", "values", "that", "are", "obtained", "from", "dereferencing", "all", "elements", "in", "vs", "." ...
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/conn.go#L620-L627
28,818
godbus/dbus
conn.go
finalize
func (tracker *callTracker) finalize(sn uint32) { tracker.lck.Lock() defer tracker.lck.Unlock() c, ok := tracker.calls[sn] if ok { delete(tracker.calls, sn) c.ContextCancel() } return }
go
func (tracker *callTracker) finalize(sn uint32) { tracker.lck.Lock() defer tracker.lck.Unlock() c, ok := tracker.calls[sn] if ok { delete(tracker.calls, sn) c.ContextCancel() } return }
[ "func", "(", "tracker", "*", "callTracker", ")", "finalize", "(", "sn", "uint32", ")", "{", "tracker", ".", "lck", ".", "Lock", "(", ")", "\n", "defer", "tracker", ".", "lck", ".", "Unlock", "(", ")", "\n", "c", ",", "ok", ":=", "tracker", ".", "...
// finalize was the only func that did not strobe Done
[ "finalize", "was", "the", "only", "func", "that", "did", "not", "strobe", "Done" ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/conn.go#L796-L805
28,819
godbus/dbus
object.go
CallWithContext
func (o *Object) CallWithContext(ctx context.Context, method string, flags Flags, args ...interface{}) *Call { return <-o.createCall(ctx, method, flags, make(chan *Call, 1), args...).Done }
go
func (o *Object) CallWithContext(ctx context.Context, method string, flags Flags, args ...interface{}) *Call { return <-o.createCall(ctx, method, flags, make(chan *Call, 1), args...).Done }
[ "func", "(", "o", "*", "Object", ")", "CallWithContext", "(", "ctx", "context", ".", "Context", ",", "method", "string", ",", "flags", "Flags", ",", "args", "...", "interface", "{", "}", ")", "*", "Call", "{", "return", "<-", "o", ".", "createCall", ...
// CallWithContext acts like Call but takes a context
[ "CallWithContext", "acts", "like", "Call", "but", "takes", "a", "context" ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/object.go#L37-L39
28,820
godbus/dbus
object.go
GoWithContext
func (o *Object) GoWithContext(ctx context.Context, method string, flags Flags, ch chan *Call, args ...interface{}) *Call { return o.createCall(ctx, method, flags, ch, args...) }
go
func (o *Object) GoWithContext(ctx context.Context, method string, flags Flags, ch chan *Call, args ...interface{}) *Call { return o.createCall(ctx, method, flags, ch, args...) }
[ "func", "(", "o", "*", "Object", ")", "GoWithContext", "(", "ctx", "context", ".", "Context", ",", "method", "string", ",", "flags", "Flags", ",", "ch", "chan", "*", "Call", ",", "args", "...", "interface", "{", "}", ")", "*", "Call", "{", "return", ...
// GoWithContext acts like Go but takes a context
[ "GoWithContext", "acts", "like", "Go", "but", "takes", "a", "context" ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/object.go#L119-L121
28,821
godbus/dbus
object.go
GetProperty
func (o *Object) GetProperty(p string) (Variant, error) { idx := strings.LastIndex(p, ".") if idx == -1 || idx+1 == len(p) { return Variant{}, errors.New("dbus: invalid property " + p) } iface := p[:idx] prop := p[idx+1:] result := Variant{} err := o.Call("org.freedesktop.DBus.Properties.Get", 0, iface, prop...
go
func (o *Object) GetProperty(p string) (Variant, error) { idx := strings.LastIndex(p, ".") if idx == -1 || idx+1 == len(p) { return Variant{}, errors.New("dbus: invalid property " + p) } iface := p[:idx] prop := p[idx+1:] result := Variant{} err := o.Call("org.freedesktop.DBus.Properties.Get", 0, iface, prop...
[ "func", "(", "o", "*", "Object", ")", "GetProperty", "(", "p", "string", ")", "(", "Variant", ",", "error", ")", "{", "idx", ":=", "strings", ".", "LastIndex", "(", "p", ",", "\"", "\"", ")", "\n", "if", "idx", "==", "-", "1", "||", "idx", "+",...
// GetProperty calls org.freedesktop.DBus.Properties.Get on the given // object. The property name must be given in interface.member notation.
[ "GetProperty", "calls", "org", ".", "freedesktop", ".", "DBus", ".", "Properties", ".", "Get", "on", "the", "given", "object", ".", "The", "property", "name", "must", "be", "given", "in", "interface", ".", "member", "notation", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/object.go#L193-L210
28,822
godbus/dbus
object.go
SetProperty
func (o *Object) SetProperty(p string, v interface{}) error { idx := strings.LastIndex(p, ".") if idx == -1 || idx+1 == len(p) { return errors.New("dbus: invalid property " + p) } iface := p[:idx] prop := p[idx+1:] return o.Call("org.freedesktop.DBus.Properties.Set", 0, iface, prop, v).Err }
go
func (o *Object) SetProperty(p string, v interface{}) error { idx := strings.LastIndex(p, ".") if idx == -1 || idx+1 == len(p) { return errors.New("dbus: invalid property " + p) } iface := p[:idx] prop := p[idx+1:] return o.Call("org.freedesktop.DBus.Properties.Set", 0, iface, prop, v).Err }
[ "func", "(", "o", "*", "Object", ")", "SetProperty", "(", "p", "string", ",", "v", "interface", "{", "}", ")", "error", "{", "idx", ":=", "strings", ".", "LastIndex", "(", "p", ",", "\"", "\"", ")", "\n", "if", "idx", "==", "-", "1", "||", "idx...
// SetProperty calls org.freedesktop.DBus.Properties.Set on the given // object. The property name must be given in interface.member notation.
[ "SetProperty", "calls", "org", ".", "freedesktop", ".", "DBus", ".", "Properties", ".", "Set", "on", "the", "given", "object", ".", "The", "property", "name", "must", "be", "given", "in", "interface", ".", "member", "notation", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/object.go#L214-L224
28,823
hashicorp/go-hclog
hclogvet/buildtag.go
checkBuildTag
func checkBuildTag(name string, data []byte) { if !vet("buildtags") { return } lines := bytes.SplitAfter(data, nl) // Determine cutpoint where +build comments are no longer valid. // They are valid in leading // comments in the file followed by // a blank line. var cutoff int for i, line := range lines { l...
go
func checkBuildTag(name string, data []byte) { if !vet("buildtags") { return } lines := bytes.SplitAfter(data, nl) // Determine cutpoint where +build comments are no longer valid. // They are valid in leading // comments in the file followed by // a blank line. var cutoff int for i, line := range lines { l...
[ "func", "checkBuildTag", "(", "name", "string", ",", "data", "[", "]", "byte", ")", "{", "if", "!", "vet", "(", "\"", "\"", ")", "{", "return", "\n", "}", "\n", "lines", ":=", "bytes", ".", "SplitAfter", "(", "data", ",", "nl", ")", "\n\n", "// D...
// checkBuildTag checks that build tags are in the correct location and well-formed.
[ "checkBuildTag", "checks", "that", "build", "tags", "are", "in", "the", "correct", "location", "and", "well", "-", "formed", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/buildtag.go#L22-L91
28,824
hashicorp/go-hclog
writer.go
NewLeveledWriter
func NewLeveledWriter(standard io.Writer, overrides map[Level]io.Writer) *LeveledWriter { return &LeveledWriter{ standard: standard, overrides: overrides, } }
go
func NewLeveledWriter(standard io.Writer, overrides map[Level]io.Writer) *LeveledWriter { return &LeveledWriter{ standard: standard, overrides: overrides, } }
[ "func", "NewLeveledWriter", "(", "standard", "io", ".", "Writer", ",", "overrides", "map", "[", "Level", "]", "io", ".", "Writer", ")", "*", "LeveledWriter", "{", "return", "&", "LeveledWriter", "{", "standard", ":", "standard", ",", "overrides", ":", "ove...
// NewLeveledWriter returns an initialized LeveledWriter. // // standard will be used as the default writer for all log levels, // except for log levels that are defined in the overrides map.
[ "NewLeveledWriter", "returns", "an", "initialized", "LeveledWriter", ".", "standard", "will", "be", "used", "as", "the", "default", "writer", "for", "all", "log", "levels", "except", "for", "log", "levels", "that", "are", "defined", "in", "the", "overrides", "...
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/writer.go#L55-L60
28,825
hashicorp/go-hclog
writer.go
LevelWrite
func (lw *LeveledWriter) LevelWrite(level Level, p []byte) (int, error) { w, ok := lw.overrides[level] if !ok { w = lw.standard } return w.Write(p) }
go
func (lw *LeveledWriter) LevelWrite(level Level, p []byte) (int, error) { w, ok := lw.overrides[level] if !ok { w = lw.standard } return w.Write(p) }
[ "func", "(", "lw", "*", "LeveledWriter", ")", "LevelWrite", "(", "level", "Level", ",", "p", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "w", ",", "ok", ":=", "lw", ".", "overrides", "[", "level", "]", "\n", "if", "!", "ok", "{",...
// LevelWrite implements LevelWriter.
[ "LevelWrite", "implements", "LevelWriter", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/writer.go#L68-L74
28,826
hashicorp/go-hclog
hclogvet/dead.go
updateDead
func (f *File) updateDead(node ast.Node) { if f.dead[node] { // The node is already marked as dead. return } switch stmt := node.(type) { case *ast.IfStmt: // "if" branch is dead if its condition evaluates // to constant false. v := f.pkg.types[stmt.Cond].Value if v == nil { return } if !constan...
go
func (f *File) updateDead(node ast.Node) { if f.dead[node] { // The node is already marked as dead. return } switch stmt := node.(type) { case *ast.IfStmt: // "if" branch is dead if its condition evaluates // to constant false. v := f.pkg.types[stmt.Cond].Value if v == nil { return } if !constan...
[ "func", "(", "f", "*", "File", ")", "updateDead", "(", "node", "ast", ".", "Node", ")", "{", "if", "f", ".", "dead", "[", "node", "]", "{", "// The node is already marked as dead.", "return", "\n", "}", "\n\n", "switch", "stmt", ":=", "node", ".", "(",...
// updateDead puts unreachable "if" and "case" nodes into f.dead.
[ "updateDead", "puts", "unreachable", "if", "and", "case", "nodes", "into", "f", ".", "dead", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/dead.go#L16-L88
28,827
hashicorp/go-hclog
hclogvet/dead.go
setDead
func (f *File) setDead(node ast.Node) { dv := deadVisitor{ f: f, } ast.Walk(dv, node) }
go
func (f *File) setDead(node ast.Node) { dv := deadVisitor{ f: f, } ast.Walk(dv, node) }
[ "func", "(", "f", "*", "File", ")", "setDead", "(", "node", "ast", ".", "Node", ")", "{", "dv", ":=", "deadVisitor", "{", "f", ":", "f", ",", "}", "\n", "ast", ".", "Walk", "(", "dv", ",", "node", ")", "\n", "}" ]
// setDead marks the node and all the children as dead.
[ "setDead", "marks", "the", "node", "and", "all", "the", "children", "as", "dead", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/dead.go#L91-L96
28,828
hashicorp/go-hclog
hclogvet/main.go
Usage
func Usage() { fmt.Fprintf(os.Stderr, "Usage of vet:\n") fmt.Fprintf(os.Stderr, "\tvet [flags] directory...\n") fmt.Fprintf(os.Stderr, "\tvet [flags] files... # Must be a single package\n") fmt.Fprintf(os.Stderr, "By default, -all is set and all non-experimental checks are run.\n") fmt.Fprintf(os.Stderr, "For more...
go
func Usage() { fmt.Fprintf(os.Stderr, "Usage of vet:\n") fmt.Fprintf(os.Stderr, "\tvet [flags] directory...\n") fmt.Fprintf(os.Stderr, "\tvet [flags] files... # Must be a single package\n") fmt.Fprintf(os.Stderr, "By default, -all is set and all non-experimental checks are run.\n") fmt.Fprintf(os.Stderr, "For more...
[ "func", "Usage", "(", ")", "{", "fmt", ".", "Fprintf", "(", "os", ".", "Stderr", ",", "\"", "\\n", "\"", ")", "\n", "fmt", ".", "Fprintf", "(", "os", ".", "Stderr", ",", "\"", "\\t", "\\n", "\"", ")", "\n", "fmt", ".", "Fprintf", "(", "os", "...
// Usage is a replacement usage function for the flags package.
[ "Usage", "is", "a", "replacement", "usage", "function", "for", "the", "flags", "package", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/main.go#L173-L183
28,829
hashicorp/go-hclog
hclogvet/main.go
prefixDirectory
func prefixDirectory(directory string, names []string) { if directory != "." { for i, name := range names { names[i] = filepath.Join(directory, name) } } }
go
func prefixDirectory(directory string, names []string) { if directory != "." { for i, name := range names { names[i] = filepath.Join(directory, name) } } }
[ "func", "prefixDirectory", "(", "directory", "string", ",", "names", "[", "]", "string", ")", "{", "if", "directory", "!=", "\"", "\"", "{", "for", "i", ",", "name", ":=", "range", "names", "{", "names", "[", "i", "]", "=", "filepath", ".", "Join", ...
// prefixDirectory places the directory name on the beginning of each name in the list.
[ "prefixDirectory", "places", "the", "directory", "name", "on", "the", "beginning", "of", "each", "name", "in", "the", "list", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/main.go#L278-L284
28,830
hashicorp/go-hclog
hclogvet/main.go
doPackageCfg
func doPackageCfg(cfgFile string) { js, err := ioutil.ReadFile(cfgFile) if err != nil { errorf("%v", err) } if err := json.Unmarshal(js, &vcfg); err != nil { errorf("parsing vet config %s: %v", cfgFile, err) } stdImporter = &vcfg inittypes() mustTypecheck = true doPackage(vcfg.GoFiles, nil) }
go
func doPackageCfg(cfgFile string) { js, err := ioutil.ReadFile(cfgFile) if err != nil { errorf("%v", err) } if err := json.Unmarshal(js, &vcfg); err != nil { errorf("parsing vet config %s: %v", cfgFile, err) } stdImporter = &vcfg inittypes() mustTypecheck = true doPackage(vcfg.GoFiles, nil) }
[ "func", "doPackageCfg", "(", "cfgFile", "string", ")", "{", "js", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "cfgFile", ")", "\n", "if", "err", "!=", "nil", "{", "errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "err", ":=...
// doPackageCfg analyzes a single package described in a config file.
[ "doPackageCfg", "analyzes", "a", "single", "package", "described", "in", "a", "config", "file", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/main.go#L333-L345
28,831
hashicorp/go-hclog
hclogvet/main.go
doPackageDir
func doPackageDir(directory string) { context := build.Default if len(context.BuildTags) != 0 { warnf("build tags %s previously set", context.BuildTags) } context.BuildTags = append(tagList, context.BuildTags...) pkg, err := context.ImportDir(directory, 0) if err != nil { // If it's just that there are no go...
go
func doPackageDir(directory string) { context := build.Default if len(context.BuildTags) != 0 { warnf("build tags %s previously set", context.BuildTags) } context.BuildTags = append(tagList, context.BuildTags...) pkg, err := context.ImportDir(directory, 0) if err != nil { // If it's just that there are no go...
[ "func", "doPackageDir", "(", "directory", "string", ")", "{", "context", ":=", "build", ".", "Default", "\n", "if", "len", "(", "context", ".", "BuildTags", ")", "!=", "0", "{", "warnf", "(", "\"", "\"", ",", "context", ".", "BuildTags", ")", "\n", "...
// doPackageDir analyzes the single package found in the directory, if there is one, // plus a test package, if there is one.
[ "doPackageDir", "analyzes", "the", "single", "package", "found", "in", "the", "directory", "if", "there", "is", "one", "plus", "a", "test", "package", "if", "there", "is", "one", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/main.go#L349-L379
28,832
hashicorp/go-hclog
hclogvet/main.go
doPackage
func doPackage(names []string, basePkg *Package) *Package { var files []*File var astFiles []*ast.File fs := token.NewFileSet() for _, name := range names { data, err := ioutil.ReadFile(name) if err != nil { // Warn but continue to next package. warnf("%s: %s", name, err) return nil } checkBuildTag...
go
func doPackage(names []string, basePkg *Package) *Package { var files []*File var astFiles []*ast.File fs := token.NewFileSet() for _, name := range names { data, err := ioutil.ReadFile(name) if err != nil { // Warn but continue to next package. warnf("%s: %s", name, err) return nil } checkBuildTag...
[ "func", "doPackage", "(", "names", "[", "]", "string", ",", "basePkg", "*", "Package", ")", "*", "Package", "{", "var", "files", "[", "]", "*", "File", "\n", "var", "astFiles", "[", "]", "*", "ast", ".", "File", "\n", "fs", ":=", "token", ".", "N...
// doPackage analyzes the single package constructed from the named files. // It returns the parsed Package or nil if none of the files have been checked.
[ "doPackage", "analyzes", "the", "single", "package", "constructed", "from", "the", "named", "files", ".", "It", "returns", "the", "parsed", "Package", "or", "nil", "if", "none", "of", "the", "files", "have", "been", "checked", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/main.go#L394-L467
28,833
hashicorp/go-hclog
hclogvet/main.go
warnf
func warnf(format string, args ...interface{}) { fmt.Fprintf(os.Stderr, "vet: "+format+"\n", args...) setExit(1) }
go
func warnf(format string, args ...interface{}) { fmt.Fprintf(os.Stderr, "vet: "+format+"\n", args...) setExit(1) }
[ "func", "warnf", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "fmt", ".", "Fprintf", "(", "os", ".", "Stderr", ",", "\"", "\"", "+", "format", "+", "\"", "\\n", "\"", ",", "args", "...", ")", "\n", "setExit", "(",...
// warnf formats the error to standard error, adding program // identification and a newline, but does not exit.
[ "warnf", "formats", "the", "error", "to", "standard", "error", "adding", "program", "identification", "and", "a", "newline", "but", "does", "not", "exit", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/main.go#L505-L508
28,834
hashicorp/go-hclog
hclogvet/main.go
Bad
func (f *File) Bad(pos token.Pos, args ...interface{}) { f.Warn(pos, args...) setExit(1) }
go
func (f *File) Bad(pos token.Pos, args ...interface{}) { f.Warn(pos, args...) setExit(1) }
[ "func", "(", "f", "*", "File", ")", "Bad", "(", "pos", "token", ".", "Pos", ",", "args", "...", "interface", "{", "}", ")", "{", "f", ".", "Warn", "(", "pos", ",", "args", "...", ")", "\n", "setExit", "(", "1", ")", "\n", "}" ]
// Bad reports an error and sets the exit code..
[ "Bad", "reports", "an", "error", "and", "sets", "the", "exit", "code", ".." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/main.go#L527-L530
28,835
hashicorp/go-hclog
hclogvet/main.go
Badf
func (f *File) Badf(pos token.Pos, format string, args ...interface{}) { f.Warnf(pos, format, args...) setExit(1) }
go
func (f *File) Badf(pos token.Pos, format string, args ...interface{}) { f.Warnf(pos, format, args...) setExit(1) }
[ "func", "(", "f", "*", "File", ")", "Badf", "(", "pos", "token", ".", "Pos", ",", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "f", ".", "Warnf", "(", "pos", ",", "format", ",", "args", "...", ")", "\n", "setExit", "...
// Badf reports a formatted error and sets the exit code.
[ "Badf", "reports", "a", "formatted", "error", "and", "sets", "the", "exit", "code", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/main.go#L533-L536
28,836
hashicorp/go-hclog
hclogvet/main.go
loc
func (f *File) loc(pos token.Pos) string { if pos == token.NoPos { return "" } // Do not print columns. Because the pos often points to the start of an // expression instead of the inner part with the actual error, the // precision can mislead. posn := f.fset.Position(pos) return fmt.Sprintf("%s:%d", posn.File...
go
func (f *File) loc(pos token.Pos) string { if pos == token.NoPos { return "" } // Do not print columns. Because the pos often points to the start of an // expression instead of the inner part with the actual error, the // precision can mislead. posn := f.fset.Position(pos) return fmt.Sprintf("%s:%d", posn.File...
[ "func", "(", "f", "*", "File", ")", "loc", "(", "pos", "token", ".", "Pos", ")", "string", "{", "if", "pos", "==", "token", ".", "NoPos", "{", "return", "\"", "\"", "\n", "}", "\n", "// Do not print columns. Because the pos often points to the start of an", ...
// loc returns a formatted representation of the position.
[ "loc", "returns", "a", "formatted", "representation", "of", "the", "position", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/main.go#L539-L548
28,837
hashicorp/go-hclog
hclogvet/main.go
locPrefix
func (f *File) locPrefix(pos token.Pos) string { if pos == token.NoPos { return "" } return fmt.Sprintf("%s: ", f.loc(pos)) }
go
func (f *File) locPrefix(pos token.Pos) string { if pos == token.NoPos { return "" } return fmt.Sprintf("%s: ", f.loc(pos)) }
[ "func", "(", "f", "*", "File", ")", "locPrefix", "(", "pos", "token", ".", "Pos", ")", "string", "{", "if", "pos", "==", "token", ".", "NoPos", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "...
// locPrefix returns a formatted representation of the position for use as a line prefix.
[ "locPrefix", "returns", "a", "formatted", "representation", "of", "the", "position", "for", "use", "as", "a", "line", "prefix", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/main.go#L551-L556
28,838
hashicorp/go-hclog
hclogvet/main.go
Warn
func (f *File) Warn(pos token.Pos, args ...interface{}) { fmt.Fprintf(os.Stderr, "%s%s", f.locPrefix(pos), fmt.Sprintln(args...)) }
go
func (f *File) Warn(pos token.Pos, args ...interface{}) { fmt.Fprintf(os.Stderr, "%s%s", f.locPrefix(pos), fmt.Sprintln(args...)) }
[ "func", "(", "f", "*", "File", ")", "Warn", "(", "pos", "token", ".", "Pos", ",", "args", "...", "interface", "{", "}", ")", "{", "fmt", ".", "Fprintf", "(", "os", ".", "Stderr", ",", "\"", "\"", ",", "f", ".", "locPrefix", "(", "pos", ")", "...
// Warn reports an error but does not set the exit code.
[ "Warn", "reports", "an", "error", "but", "does", "not", "set", "the", "exit", "code", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/main.go#L559-L561
28,839
hashicorp/go-hclog
hclogvet/main.go
Warnf
func (f *File) Warnf(pos token.Pos, format string, args ...interface{}) { fmt.Fprintf(os.Stderr, "%s%s\n", f.locPrefix(pos), fmt.Sprintf(format, args...)) }
go
func (f *File) Warnf(pos token.Pos, format string, args ...interface{}) { fmt.Fprintf(os.Stderr, "%s%s\n", f.locPrefix(pos), fmt.Sprintf(format, args...)) }
[ "func", "(", "f", "*", "File", ")", "Warnf", "(", "pos", "token", ".", "Pos", ",", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "fmt", ".", "Fprintf", "(", "os", ".", "Stderr", ",", "\"", "\\n", "\"", ",", "f", ".", ...
// Warnf reports a formatted error but does not set the exit code.
[ "Warnf", "reports", "a", "formatted", "error", "but", "does", "not", "set", "the", "exit", "code", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/main.go#L564-L566
28,840
hashicorp/go-hclog
hclogvet/main.go
walkFile
func (f *File) walkFile(name string, file *ast.File) { Println("Checking file", name) ast.Walk(f, file) }
go
func (f *File) walkFile(name string, file *ast.File) { Println("Checking file", name) ast.Walk(f, file) }
[ "func", "(", "f", "*", "File", ")", "walkFile", "(", "name", "string", ",", "file", "*", "ast", ".", "File", ")", "{", "Println", "(", "\"", "\"", ",", "name", ")", "\n", "ast", ".", "Walk", "(", "f", ",", "file", ")", "\n", "}" ]
// walkFile walks the file's tree.
[ "walkFile", "walks", "the", "file", "s", "tree", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/main.go#L569-L572
28,841
hashicorp/go-hclog
hclogvet/main.go
gofmt
func (f *File) gofmt(x ast.Expr) string { f.b.Reset() printer.Fprint(&f.b, f.fset, x) return f.b.String() }
go
func (f *File) gofmt(x ast.Expr) string { f.b.Reset() printer.Fprint(&f.b, f.fset, x) return f.b.String() }
[ "func", "(", "f", "*", "File", ")", "gofmt", "(", "x", "ast", ".", "Expr", ")", "string", "{", "f", ".", "b", ".", "Reset", "(", ")", "\n", "printer", ".", "Fprint", "(", "&", "f", ".", "b", ",", "f", ".", "fset", ",", "x", ")", "\n", "re...
// gofmt returns a string representation of the expression.
[ "gofmt", "returns", "a", "string", "representation", "of", "the", "expression", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/main.go#L613-L617
28,842
hashicorp/go-hclog
intlogger.go
New
func New(opts *LoggerOptions) Logger { if opts == nil { opts = &LoggerOptions{} } output := opts.Output if output == nil { output = DefaultOutput } level := opts.Level if level == NoLevel { level = DefaultLevel } mutex := opts.Mutex if mutex == nil { mutex = new(sync.Mutex) } l := &intLogger{ ...
go
func New(opts *LoggerOptions) Logger { if opts == nil { opts = &LoggerOptions{} } output := opts.Output if output == nil { output = DefaultOutput } level := opts.Level if level == NoLevel { level = DefaultLevel } mutex := opts.Mutex if mutex == nil { mutex = new(sync.Mutex) } l := &intLogger{ ...
[ "func", "New", "(", "opts", "*", "LoggerOptions", ")", "Logger", "{", "if", "opts", "==", "nil", "{", "opts", "=", "&", "LoggerOptions", "{", "}", "\n", "}", "\n\n", "output", ":=", "opts", ".", "Output", "\n", "if", "output", "==", "nil", "{", "ou...
// New returns a configured logger.
[ "New", "returns", "a", "configured", "logger", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L58-L95
28,843
hashicorp/go-hclog
intlogger.go
trimCallerPath
func trimCallerPath(path string) string { // lovely borrowed from zap // nb. To make sure we trim the path correctly on Windows too, we // counter-intuitively need to use '/' and *not* os.PathSeparator here, // because the path given originates from Go stdlib, specifically // runtime.Caller() which (as of Mar/17) ...
go
func trimCallerPath(path string) string { // lovely borrowed from zap // nb. To make sure we trim the path correctly on Windows too, we // counter-intuitively need to use '/' and *not* os.PathSeparator here, // because the path given originates from Go stdlib, specifically // runtime.Caller() which (as of Mar/17) ...
[ "func", "trimCallerPath", "(", "path", "string", ")", "string", "{", "// lovely borrowed from zap", "// nb. To make sure we trim the path correctly on Windows too, we", "// counter-intuitively need to use '/' and *not* os.PathSeparator here,", "// because the path given originates from Go stdl...
// Cleanup a path by returning the last 2 segments of the path only.
[ "Cleanup", "a", "path", "by", "returning", "the", "last", "2", "segments", "of", "the", "path", "only", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L119-L145
28,844
hashicorp/go-hclog
intlogger.go
logJSON
func (l *intLogger) logJSON(t time.Time, level Level, msg string, args ...interface{}) { vals := l.jsonMapEntry(t, level, msg) args = append(l.implied, args...) if args != nil && len(args) > 0 { if len(args)%2 != 0 { cs, ok := args[len(args)-1].(CapturedStacktrace) if ok { args = args[:len(args)-1] ...
go
func (l *intLogger) logJSON(t time.Time, level Level, msg string, args ...interface{}) { vals := l.jsonMapEntry(t, level, msg) args = append(l.implied, args...) if args != nil && len(args) > 0 { if len(args)%2 != 0 { cs, ok := args[len(args)-1].(CapturedStacktrace) if ok { args = args[:len(args)-1] ...
[ "func", "(", "l", "*", "intLogger", ")", "logJSON", "(", "t", "time", ".", "Time", ",", "level", "Level", ",", "msg", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "vals", ":=", "l", ".", "jsonMapEntry", "(", "t", ",", "level", "...
// JSON logging function
[ "JSON", "logging", "function" ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L301-L350
28,845
hashicorp/go-hclog
intlogger.go
Debug
func (l *intLogger) Debug(msg string, args ...interface{}) { l.Log(Debug, msg, args...) }
go
func (l *intLogger) Debug(msg string, args ...interface{}) { l.Log(Debug, msg, args...) }
[ "func", "(", "l", "*", "intLogger", ")", "Debug", "(", "msg", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "l", ".", "Log", "(", "Debug", ",", "msg", ",", "args", "...", ")", "\n", "}" ]
// Emit the message and args at DEBUG level
[ "Emit", "the", "message", "and", "args", "at", "DEBUG", "level" ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L389-L391
28,846
hashicorp/go-hclog
intlogger.go
Trace
func (l *intLogger) Trace(msg string, args ...interface{}) { l.Log(Trace, msg, args...) }
go
func (l *intLogger) Trace(msg string, args ...interface{}) { l.Log(Trace, msg, args...) }
[ "func", "(", "l", "*", "intLogger", ")", "Trace", "(", "msg", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "l", ".", "Log", "(", "Trace", ",", "msg", ",", "args", "...", ")", "\n", "}" ]
// Emit the message and args at TRACE level
[ "Emit", "the", "message", "and", "args", "at", "TRACE", "level" ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L394-L396
28,847
hashicorp/go-hclog
intlogger.go
Info
func (l *intLogger) Info(msg string, args ...interface{}) { l.Log(Info, msg, args...) }
go
func (l *intLogger) Info(msg string, args ...interface{}) { l.Log(Info, msg, args...) }
[ "func", "(", "l", "*", "intLogger", ")", "Info", "(", "msg", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "l", ".", "Log", "(", "Info", ",", "msg", ",", "args", "...", ")", "\n", "}" ]
// Emit the message and args at INFO level
[ "Emit", "the", "message", "and", "args", "at", "INFO", "level" ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L399-L401
28,848
hashicorp/go-hclog
intlogger.go
Warn
func (l *intLogger) Warn(msg string, args ...interface{}) { l.Log(Warn, msg, args...) }
go
func (l *intLogger) Warn(msg string, args ...interface{}) { l.Log(Warn, msg, args...) }
[ "func", "(", "l", "*", "intLogger", ")", "Warn", "(", "msg", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "l", ".", "Log", "(", "Warn", ",", "msg", ",", "args", "...", ")", "\n", "}" ]
// Emit the message and args at WARN level
[ "Emit", "the", "message", "and", "args", "at", "WARN", "level" ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L404-L406
28,849
hashicorp/go-hclog
intlogger.go
Error
func (l *intLogger) Error(msg string, args ...interface{}) { l.Log(Error, msg, args...) }
go
func (l *intLogger) Error(msg string, args ...interface{}) { l.Log(Error, msg, args...) }
[ "func", "(", "l", "*", "intLogger", ")", "Error", "(", "msg", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "l", ".", "Log", "(", "Error", ",", "msg", ",", "args", "...", ")", "\n", "}" ]
// Emit the message and args at ERROR level
[ "Emit", "the", "message", "and", "args", "at", "ERROR", "level" ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L409-L411
28,850
hashicorp/go-hclog
intlogger.go
IsTrace
func (l *intLogger) IsTrace() bool { return Level(atomic.LoadInt32(l.level)) == Trace }
go
func (l *intLogger) IsTrace() bool { return Level(atomic.LoadInt32(l.level)) == Trace }
[ "func", "(", "l", "*", "intLogger", ")", "IsTrace", "(", ")", "bool", "{", "return", "Level", "(", "atomic", ".", "LoadInt32", "(", "l", ".", "level", ")", ")", "==", "Trace", "\n", "}" ]
// Indicate that the logger would emit TRACE level logs
[ "Indicate", "that", "the", "logger", "would", "emit", "TRACE", "level", "logs" ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L414-L416
28,851
hashicorp/go-hclog
intlogger.go
IsDebug
func (l *intLogger) IsDebug() bool { return Level(atomic.LoadInt32(l.level)) <= Debug }
go
func (l *intLogger) IsDebug() bool { return Level(atomic.LoadInt32(l.level)) <= Debug }
[ "func", "(", "l", "*", "intLogger", ")", "IsDebug", "(", ")", "bool", "{", "return", "Level", "(", "atomic", ".", "LoadInt32", "(", "l", ".", "level", ")", ")", "<=", "Debug", "\n", "}" ]
// Indicate that the logger would emit DEBUG level logs
[ "Indicate", "that", "the", "logger", "would", "emit", "DEBUG", "level", "logs" ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L419-L421
28,852
hashicorp/go-hclog
intlogger.go
IsInfo
func (l *intLogger) IsInfo() bool { return Level(atomic.LoadInt32(l.level)) <= Info }
go
func (l *intLogger) IsInfo() bool { return Level(atomic.LoadInt32(l.level)) <= Info }
[ "func", "(", "l", "*", "intLogger", ")", "IsInfo", "(", ")", "bool", "{", "return", "Level", "(", "atomic", ".", "LoadInt32", "(", "l", ".", "level", ")", ")", "<=", "Info", "\n", "}" ]
// Indicate that the logger would emit INFO level logs
[ "Indicate", "that", "the", "logger", "would", "emit", "INFO", "level", "logs" ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L424-L426
28,853
hashicorp/go-hclog
intlogger.go
IsWarn
func (l *intLogger) IsWarn() bool { return Level(atomic.LoadInt32(l.level)) <= Warn }
go
func (l *intLogger) IsWarn() bool { return Level(atomic.LoadInt32(l.level)) <= Warn }
[ "func", "(", "l", "*", "intLogger", ")", "IsWarn", "(", ")", "bool", "{", "return", "Level", "(", "atomic", ".", "LoadInt32", "(", "l", ".", "level", ")", ")", "<=", "Warn", "\n", "}" ]
// Indicate that the logger would emit WARN level logs
[ "Indicate", "that", "the", "logger", "would", "emit", "WARN", "level", "logs" ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L429-L431
28,854
hashicorp/go-hclog
intlogger.go
IsError
func (l *intLogger) IsError() bool { return Level(atomic.LoadInt32(l.level)) <= Error }
go
func (l *intLogger) IsError() bool { return Level(atomic.LoadInt32(l.level)) <= Error }
[ "func", "(", "l", "*", "intLogger", ")", "IsError", "(", ")", "bool", "{", "return", "Level", "(", "atomic", ".", "LoadInt32", "(", "l", ".", "level", ")", ")", "<=", "Error", "\n", "}" ]
// Indicate that the logger would emit ERROR level logs
[ "Indicate", "that", "the", "logger", "would", "emit", "ERROR", "level", "logs" ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L434-L436
28,855
hashicorp/go-hclog
intlogger.go
Named
func (l *intLogger) Named(name string) Logger { sl := *l if sl.name != "" { sl.name = sl.name + "." + name } else { sl.name = name } return &sl }
go
func (l *intLogger) Named(name string) Logger { sl := *l if sl.name != "" { sl.name = sl.name + "." + name } else { sl.name = name } return &sl }
[ "func", "(", "l", "*", "intLogger", ")", "Named", "(", "name", "string", ")", "Logger", "{", "sl", ":=", "*", "l", "\n\n", "if", "sl", ".", "name", "!=", "\"", "\"", "{", "sl", ".", "name", "=", "sl", ".", "name", "+", "\"", "\"", "+", "name"...
// Create a new sub-Logger that a name decending from the current name. // This is used to create a subsystem specific Logger.
[ "Create", "a", "new", "sub", "-", "Logger", "that", "a", "name", "decending", "from", "the", "current", "name", ".", "This", "is", "used", "to", "create", "a", "subsystem", "specific", "Logger", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L481-L491
28,856
hashicorp/go-hclog
intlogger.go
ResetNamed
func (l *intLogger) ResetNamed(name string) Logger { sl := *l sl.name = name return &sl }
go
func (l *intLogger) ResetNamed(name string) Logger { sl := *l sl.name = name return &sl }
[ "func", "(", "l", "*", "intLogger", ")", "ResetNamed", "(", "name", "string", ")", "Logger", "{", "sl", ":=", "*", "l", "\n\n", "sl", ".", "name", "=", "name", "\n\n", "return", "&", "sl", "\n", "}" ]
// Create a new sub-Logger with an explicit name. This ignores the current // name. This is used to create a standalone logger that doesn't fall // within the normal hierarchy.
[ "Create", "a", "new", "sub", "-", "Logger", "with", "an", "explicit", "name", ".", "This", "ignores", "the", "current", "name", ".", "This", "is", "used", "to", "create", "a", "standalone", "logger", "that", "doesn", "t", "fall", "within", "the", "normal...
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L496-L502
28,857
hashicorp/go-hclog
intlogger.go
SetLevel
func (l *intLogger) SetLevel(level Level) { atomic.StoreInt32(l.level, int32(level)) }
go
func (l *intLogger) SetLevel(level Level) { atomic.StoreInt32(l.level, int32(level)) }
[ "func", "(", "l", "*", "intLogger", ")", "SetLevel", "(", "level", "Level", ")", "{", "atomic", ".", "StoreInt32", "(", "l", ".", "level", ",", "int32", "(", "level", ")", ")", "\n", "}" ]
// Update the logging level on-the-fly. This will affect all subloggers as // well.
[ "Update", "the", "logging", "level", "on", "-", "the", "-", "fly", ".", "This", "will", "affect", "all", "subloggers", "as", "well", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/intlogger.go#L506-L508
28,858
hashicorp/go-hclog
stdlog.go
Write
func (s *stdlogAdapter) Write(data []byte) (int, error) { str := string(bytes.TrimRight(data, " \t\n")) if s.forceLevel != NoLevel { // Use pickLevel to strip log levels included in the line since we are // forcing the level _, str := s.pickLevel(str) // Log at the forced level switch s.forceLevel { cas...
go
func (s *stdlogAdapter) Write(data []byte) (int, error) { str := string(bytes.TrimRight(data, " \t\n")) if s.forceLevel != NoLevel { // Use pickLevel to strip log levels included in the line since we are // forcing the level _, str := s.pickLevel(str) // Log at the forced level switch s.forceLevel { cas...
[ "func", "(", "s", "*", "stdlogAdapter", ")", "Write", "(", "data", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "str", ":=", "string", "(", "bytes", ".", "TrimRight", "(", "data", ",", "\"", "\\t", "\\n", "\"", ")", ")", "\n\n", "...
// Take the data, infer the levels if configured, and send it through // a regular Logger.
[ "Take", "the", "data", "infer", "the", "levels", "if", "configured", "and", "send", "it", "through", "a", "regular", "Logger", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/stdlog.go#L19-L63
28,859
hashicorp/go-hclog
stdlog.go
pickLevel
func (s *stdlogAdapter) pickLevel(str string) (Level, string) { switch { case strings.HasPrefix(str, "[DEBUG]"): return Debug, strings.TrimSpace(str[7:]) case strings.HasPrefix(str, "[TRACE]"): return Trace, strings.TrimSpace(str[7:]) case strings.HasPrefix(str, "[INFO]"): return Info, strings.TrimSpace(str[6...
go
func (s *stdlogAdapter) pickLevel(str string) (Level, string) { switch { case strings.HasPrefix(str, "[DEBUG]"): return Debug, strings.TrimSpace(str[7:]) case strings.HasPrefix(str, "[TRACE]"): return Trace, strings.TrimSpace(str[7:]) case strings.HasPrefix(str, "[INFO]"): return Info, strings.TrimSpace(str[6...
[ "func", "(", "s", "*", "stdlogAdapter", ")", "pickLevel", "(", "str", "string", ")", "(", "Level", ",", "string", ")", "{", "switch", "{", "case", "strings", ".", "HasPrefix", "(", "str", ",", "\"", "\"", ")", ":", "return", "Debug", ",", "strings", ...
// Detect, based on conventions, what log level this is.
[ "Detect", "based", "on", "conventions", "what", "log", "level", "this", "is", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/stdlog.go#L66-L83
28,860
hashicorp/go-hclog
logger.go
LevelFromString
func LevelFromString(levelStr string) Level { // We don't care about case. Accept both "INFO" and "info". levelStr = strings.ToLower(strings.TrimSpace(levelStr)) switch levelStr { case "trace": return Trace case "debug": return Debug case "info": return Info case "warn": return Warn case "error": retu...
go
func LevelFromString(levelStr string) Level { // We don't care about case. Accept both "INFO" and "info". levelStr = strings.ToLower(strings.TrimSpace(levelStr)) switch levelStr { case "trace": return Trace case "debug": return Debug case "info": return Info case "warn": return Warn case "error": retu...
[ "func", "LevelFromString", "(", "levelStr", "string", ")", "Level", "{", "// We don't care about case. Accept both \"INFO\" and \"info\".", "levelStr", "=", "strings", ".", "ToLower", "(", "strings", ".", "TrimSpace", "(", "levelStr", ")", ")", "\n", "switch", "levelS...
// LevelFromString returns a Level type for the named log level, or "NoLevel" if // the level string is invalid. This facilitates setting the log level via // config or environment variable by name in a predictable way.
[ "LevelFromString", "returns", "a", "Level", "type", "for", "the", "named", "log", "level", "or", "NoLevel", "if", "the", "level", "string", "is", "invalid", ".", "This", "facilitates", "setting", "the", "log", "level", "via", "config", "or", "environment", "...
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/logger.go#L59-L76
28,861
hashicorp/go-hclog
hclogvet/shadow.go
contains
func (s Span) contains(pos token.Pos) bool { return s.min <= pos && pos < s.max }
go
func (s Span) contains(pos token.Pos) bool { return s.min <= pos && pos < s.max }
[ "func", "(", "s", "Span", ")", "contains", "(", "pos", "token", ".", "Pos", ")", "bool", "{", "return", "s", ".", "min", "<=", "pos", "&&", "pos", "<", "s", ".", "max", "\n", "}" ]
// contains reports whether the position is inside the span.
[ "contains", "reports", "whether", "the", "position", "is", "inside", "the", "span", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/shadow.go#L77-L79
28,862
hashicorp/go-hclog
hclogvet/shadow.go
growSpan
func (pkg *Package) growSpan(ident *ast.Ident, obj types.Object) { if *strictShadowing { return // No need } pos := ident.Pos() end := ident.End() span, ok := pkg.spans[obj] if ok { if span.min > pos { span.min = pos } if span.max < end { span.max = end } } else { span = Span{pos, end} } pkg....
go
func (pkg *Package) growSpan(ident *ast.Ident, obj types.Object) { if *strictShadowing { return // No need } pos := ident.Pos() end := ident.End() span, ok := pkg.spans[obj] if ok { if span.min > pos { span.min = pos } if span.max < end { span.max = end } } else { span = Span{pos, end} } pkg....
[ "func", "(", "pkg", "*", "Package", ")", "growSpan", "(", "ident", "*", "ast", ".", "Ident", ",", "obj", "types", ".", "Object", ")", "{", "if", "*", "strictShadowing", "{", "return", "// No need", "\n", "}", "\n", "pos", ":=", "ident", ".", "Pos", ...
// growSpan expands the span for the object to contain the instance represented // by the identifier.
[ "growSpan", "expands", "the", "span", "for", "the", "object", "to", "contain", "the", "instance", "represented", "by", "the", "identifier", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/shadow.go#L83-L101
28,863
hashicorp/go-hclog
hclogvet/shadow.go
checkShadowAssignment
func checkShadowAssignment(f *File, a *ast.AssignStmt) { if a.Tok != token.DEFINE { return } if f.idiomaticShortRedecl(a) { return } for _, expr := range a.Lhs { ident, ok := expr.(*ast.Ident) if !ok { f.Badf(expr.Pos(), "invalid AST: short variable declaration of non-identifier") return } checkS...
go
func checkShadowAssignment(f *File, a *ast.AssignStmt) { if a.Tok != token.DEFINE { return } if f.idiomaticShortRedecl(a) { return } for _, expr := range a.Lhs { ident, ok := expr.(*ast.Ident) if !ok { f.Badf(expr.Pos(), "invalid AST: short variable declaration of non-identifier") return } checkS...
[ "func", "checkShadowAssignment", "(", "f", "*", "File", ",", "a", "*", "ast", ".", "AssignStmt", ")", "{", "if", "a", ".", "Tok", "!=", "token", ".", "DEFINE", "{", "return", "\n", "}", "\n", "if", "f", ".", "idiomaticShortRedecl", "(", "a", ")", "...
// checkShadowAssignment checks for shadowing in a short variable declaration.
[ "checkShadowAssignment", "checks", "for", "shadowing", "in", "a", "short", "variable", "declaration", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/shadow.go#L104-L119
28,864
hashicorp/go-hclog
hclogvet/shadow.go
idiomaticShortRedecl
func (f *File) idiomaticShortRedecl(a *ast.AssignStmt) bool { // Don't complain about deliberate redeclarations of the form // i := i // Such constructs are idiomatic in range loops to create a new variable // for each iteration. Another example is // switch n := n.(type) if len(a.Rhs) != len(a.Lhs) { return fa...
go
func (f *File) idiomaticShortRedecl(a *ast.AssignStmt) bool { // Don't complain about deliberate redeclarations of the form // i := i // Such constructs are idiomatic in range loops to create a new variable // for each iteration. Another example is // switch n := n.(type) if len(a.Rhs) != len(a.Lhs) { return fa...
[ "func", "(", "f", "*", "File", ")", "idiomaticShortRedecl", "(", "a", "*", "ast", ".", "AssignStmt", ")", "bool", "{", "// Don't complain about deliberate redeclarations of the form", "//\ti := i", "// Such constructs are idiomatic in range loops to create a new variable", "// ...
// idiomaticShortRedecl reports whether this short declaration can be ignored for // the purposes of shadowing, that is, that any redeclarations it contains are deliberate.
[ "idiomaticShortRedecl", "reports", "whether", "this", "short", "declaration", "can", "be", "ignored", "for", "the", "purposes", "of", "shadowing", "that", "is", "that", "any", "redeclarations", "it", "contains", "are", "deliberate", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/shadow.go#L123-L155
28,865
hashicorp/go-hclog
hclogvet/shadow.go
idiomaticRedecl
func (f *File) idiomaticRedecl(d *ast.ValueSpec) bool { // Don't complain about deliberate redeclarations of the form // var i, j = i, j if len(d.Names) != len(d.Values) { return false } for i, lhs := range d.Names { if rhs, ok := d.Values[i].(*ast.Ident); ok { if lhs.Name != rhs.Name { return false ...
go
func (f *File) idiomaticRedecl(d *ast.ValueSpec) bool { // Don't complain about deliberate redeclarations of the form // var i, j = i, j if len(d.Names) != len(d.Values) { return false } for i, lhs := range d.Names { if rhs, ok := d.Values[i].(*ast.Ident); ok { if lhs.Name != rhs.Name { return false ...
[ "func", "(", "f", "*", "File", ")", "idiomaticRedecl", "(", "d", "*", "ast", ".", "ValueSpec", ")", "bool", "{", "// Don't complain about deliberate redeclarations of the form", "//\tvar i, j = i, j", "if", "len", "(", "d", ".", "Names", ")", "!=", "len", "(", ...
// idiomaticRedecl reports whether this declaration spec can be ignored for // the purposes of shadowing, that is, that any redeclarations it contains are deliberate.
[ "idiomaticRedecl", "reports", "whether", "this", "declaration", "spec", "can", "be", "ignored", "for", "the", "purposes", "of", "shadowing", "that", "is", "that", "any", "redeclarations", "it", "contains", "are", "deliberate", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/shadow.go#L159-L173
28,866
hashicorp/go-hclog
hclogvet/shadow.go
checkShadowDecl
func checkShadowDecl(f *File, d *ast.GenDecl) { if d.Tok != token.VAR { return } for _, spec := range d.Specs { valueSpec, ok := spec.(*ast.ValueSpec) if !ok { f.Badf(spec.Pos(), "invalid AST: var GenDecl not ValueSpec") return } // Don't complain about deliberate redeclarations of the form // var ...
go
func checkShadowDecl(f *File, d *ast.GenDecl) { if d.Tok != token.VAR { return } for _, spec := range d.Specs { valueSpec, ok := spec.(*ast.ValueSpec) if !ok { f.Badf(spec.Pos(), "invalid AST: var GenDecl not ValueSpec") return } // Don't complain about deliberate redeclarations of the form // var ...
[ "func", "checkShadowDecl", "(", "f", "*", "File", ",", "d", "*", "ast", ".", "GenDecl", ")", "{", "if", "d", ".", "Tok", "!=", "token", ".", "VAR", "{", "return", "\n", "}", "\n", "for", "_", ",", "spec", ":=", "range", "d", ".", "Specs", "{", ...
// checkShadowDecl checks for shadowing in a general variable declaration.
[ "checkShadowDecl", "checks", "for", "shadowing", "in", "a", "general", "variable", "declaration", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/shadow.go#L176-L195
28,867
hashicorp/go-hclog
hclogvet/shadow.go
checkShadowing
func checkShadowing(f *File, ident *ast.Ident) { if ident.Name == "_" { // Can't shadow the blank identifier. return } obj := f.pkg.defs[ident] if obj == nil { return } // obj.Parent.Parent is the surrounding scope. If we can find another declaration // starting from there, we have a shadowed identifier. ...
go
func checkShadowing(f *File, ident *ast.Ident) { if ident.Name == "_" { // Can't shadow the blank identifier. return } obj := f.pkg.defs[ident] if obj == nil { return } // obj.Parent.Parent is the surrounding scope. If we can find another declaration // starting from there, we have a shadowed identifier. ...
[ "func", "checkShadowing", "(", "f", "*", "File", ",", "ident", "*", "ast", ".", "Ident", ")", "{", "if", "ident", ".", "Name", "==", "\"", "\"", "{", "// Can't shadow the blank identifier.", "return", "\n", "}", "\n", "obj", ":=", "f", ".", "pkg", ".",...
// checkShadowing checks whether the identifier shadows an identifier in an outer scope.
[ "checkShadowing", "checks", "whether", "the", "identifier", "shadows", "an", "identifier", "in", "an", "outer", "scope", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/shadow.go#L198-L238
28,868
hashicorp/go-hclog
hclogvet/types.go
isNamedType
func isNamedType(t types.Type, path, name string) bool { n, ok := t.(*types.Named) if !ok { return false } obj := n.Obj() return obj.Name() == name && isPackage(obj.Pkg(), path) }
go
func isNamedType(t types.Type, path, name string) bool { n, ok := t.(*types.Named) if !ok { return false } obj := n.Obj() return obj.Name() == name && isPackage(obj.Pkg(), path) }
[ "func", "isNamedType", "(", "t", "types", ".", "Type", ",", "path", ",", "name", "string", ")", "bool", "{", "n", ",", "ok", ":=", "t", ".", "(", "*", "types", ".", "Named", ")", "\n", "if", "!", "ok", "{", "return", "false", "\n", "}", "\n", ...
// isNamedType reports whether t is the named type path.name.
[ "isNamedType", "reports", "whether", "t", "is", "the", "named", "type", "path", ".", "name", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/types.go#L40-L47
28,869
hashicorp/go-hclog
hclogvet/types.go
isPackage
func isPackage(pkg *types.Package, path string) bool { if pkg == nil { return false } return pkg.Path() == path || strings.HasSuffix(pkg.Path(), "/vendor/"+path) }
go
func isPackage(pkg *types.Package, path string) bool { if pkg == nil { return false } return pkg.Path() == path || strings.HasSuffix(pkg.Path(), "/vendor/"+path) }
[ "func", "isPackage", "(", "pkg", "*", "types", ".", "Package", ",", "path", "string", ")", "bool", "{", "if", "pkg", "==", "nil", "{", "return", "false", "\n", "}", "\n\n", "return", "pkg", ".", "Path", "(", ")", "==", "path", "||", "strings", ".",...
// isPackage reports whether pkg has path as the canonical path, // taking into account vendoring effects
[ "isPackage", "reports", "whether", "pkg", "has", "path", "as", "the", "canonical", "path", "taking", "into", "account", "vendoring", "effects" ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/types.go#L51-L58
28,870
hashicorp/go-hclog
hclogvet/types.go
importType
func importType(path, name string) types.Type { pkg, err := stdImporter.Import(path) if err != nil { // This can happen if the package at path hasn't been compiled yet. warnf("import failed: %v", err) return nil } if obj, ok := pkg.Scope().Lookup(name).(*types.TypeName); ok { return obj.Type() } warnf("in...
go
func importType(path, name string) types.Type { pkg, err := stdImporter.Import(path) if err != nil { // This can happen if the package at path hasn't been compiled yet. warnf("import failed: %v", err) return nil } if obj, ok := pkg.Scope().Lookup(name).(*types.TypeName); ok { return obj.Type() } warnf("in...
[ "func", "importType", "(", "path", ",", "name", "string", ")", "types", ".", "Type", "{", "pkg", ",", "err", ":=", "stdImporter", ".", "Import", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "// This can happen if the package at path hasn't been compi...
// importType returns the type denoted by the qualified identifier // path.name, and adds the respective package to the imports map // as a side effect. In case of an error, importType returns nil.
[ "importType", "returns", "the", "type", "denoted", "by", "the", "qualified", "identifier", "path", ".", "name", "and", "adds", "the", "respective", "package", "to", "the", "imports", "map", "as", "a", "side", "effect", ".", "In", "case", "of", "an", "error...
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/types.go#L63-L75
28,871
hashicorp/go-hclog
hclogvet/types.go
hasBasicType
func (f *File) hasBasicType(x ast.Expr, kind types.BasicKind) bool { t := f.pkg.types[x].Type if t != nil { t = t.Underlying() } b, ok := t.(*types.Basic) return ok && b.Kind() == kind }
go
func (f *File) hasBasicType(x ast.Expr, kind types.BasicKind) bool { t := f.pkg.types[x].Type if t != nil { t = t.Underlying() } b, ok := t.(*types.Basic) return ok && b.Kind() == kind }
[ "func", "(", "f", "*", "File", ")", "hasBasicType", "(", "x", "ast", ".", "Expr", ",", "kind", "types", ".", "BasicKind", ")", "bool", "{", "t", ":=", "f", ".", "pkg", ".", "types", "[", "x", "]", ".", "Type", "\n", "if", "t", "!=", "nil", "{...
// hasBasicType reports whether x's type is a types.Basic with the given kind.
[ "hasBasicType", "reports", "whether", "x", "s", "type", "is", "a", "types", ".", "Basic", "with", "the", "given", "kind", "." ]
d2f17ae9f9297cad64f18f15d537397e8783627b
https://github.com/hashicorp/go-hclog/blob/d2f17ae9f9297cad64f18f15d537397e8783627b/hclogvet/types.go#L143-L150
28,872
unrolled/secure
csp.go
CSPNonce
func CSPNonce(c context.Context) string { if val, ok := c.Value(cspNonceKey).(string); ok { return val } return "" }
go
func CSPNonce(c context.Context) string { if val, ok := c.Value(cspNonceKey).(string); ok { return val } return "" }
[ "func", "CSPNonce", "(", "c", "context", ".", "Context", ")", "string", "{", "if", "val", ",", "ok", ":=", "c", ".", "Value", "(", "cspNonceKey", ")", ".", "(", "string", ")", ";", "ok", "{", "return", "val", "\n", "}", "\n\n", "return", "\"", "\...
// CSPNonce returns the nonce value associated with the present request. If no nonce has been generated it returns an empty string.
[ "CSPNonce", "returns", "the", "nonce", "value", "associated", "with", "the", "present", "request", ".", "If", "no", "nonce", "has", "been", "generated", "it", "returns", "an", "empty", "string", "." ]
4e32686ccfd4360eba208873a5c397fef3b50cc4
https://github.com/unrolled/secure/blob/4e32686ccfd4360eba208873a5c397fef3b50cc4/csp.go#L16-L22
28,873
unrolled/secure
csp.go
WithCSPNonce
func WithCSPNonce(ctx context.Context, nonce string) context.Context { return context.WithValue(ctx, cspNonceKey, nonce) }
go
func WithCSPNonce(ctx context.Context, nonce string) context.Context { return context.WithValue(ctx, cspNonceKey, nonce) }
[ "func", "WithCSPNonce", "(", "ctx", "context", ".", "Context", ",", "nonce", "string", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "cspNonceKey", ",", "nonce", ")", "\n", "}" ]
// WithCSPNonce returns a context derived from ctx containing the given nonce as a value. // // This is intended for testing or more advanced use-cases; // For ordinary HTTP handlers, clients can rely on this package's middleware to populate the CSP nonce in the context.
[ "WithCSPNonce", "returns", "a", "context", "derived", "from", "ctx", "containing", "the", "given", "nonce", "as", "a", "value", ".", "This", "is", "intended", "for", "testing", "or", "more", "advanced", "use", "-", "cases", ";", "For", "ordinary", "HTTP", ...
4e32686ccfd4360eba208873a5c397fef3b50cc4
https://github.com/unrolled/secure/blob/4e32686ccfd4360eba208873a5c397fef3b50cc4/csp.go#L28-L30
28,874
unrolled/secure
secure.go
New
func New(options ...Options) *Secure { var o Options if len(options) == 0 { o = Options{} } else { o = options[0] } o.ContentSecurityPolicy = strings.Replace(o.ContentSecurityPolicy, "$NONCE", "'nonce-%[1]s'", -1) o.nonceEnabled = strings.Contains(o.ContentSecurityPolicy, "%[1]s") s := &Secure{ opt: ...
go
func New(options ...Options) *Secure { var o Options if len(options) == 0 { o = Options{} } else { o = options[0] } o.ContentSecurityPolicy = strings.Replace(o.ContentSecurityPolicy, "$NONCE", "'nonce-%[1]s'", -1) o.nonceEnabled = strings.Contains(o.ContentSecurityPolicy, "%[1]s") s := &Secure{ opt: ...
[ "func", "New", "(", "options", "...", "Options", ")", "*", "Secure", "{", "var", "o", "Options", "\n", "if", "len", "(", "options", ")", "==", "0", "{", "o", "=", "Options", "{", "}", "\n", "}", "else", "{", "o", "=", "options", "[", "0", "]", ...
// New constructs a new Secure instance with the supplied options.
[ "New", "constructs", "a", "new", "Secure", "instance", "with", "the", "supplied", "options", "." ]
4e32686ccfd4360eba208873a5c397fef3b50cc4
https://github.com/unrolled/secure/blob/4e32686ccfd4360eba208873a5c397fef3b50cc4/secure.go#L117-L146
28,875
unrolled/secure
secure.go
HandlerFuncWithNext
func (s *Secure) HandlerFuncWithNext(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { // Let secure process the request. If it returns an error, // that indicates the request should not continue. responseHeader, r, err := s.processRequest(w, r) addResponseHeaders(responseHeader, w) // If there was...
go
func (s *Secure) HandlerFuncWithNext(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { // Let secure process the request. If it returns an error, // that indicates the request should not continue. responseHeader, r, err := s.processRequest(w, r) addResponseHeaders(responseHeader, w) // If there was...
[ "func", "(", "s", "*", "Secure", ")", "HandlerFuncWithNext", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "next", "http", ".", "HandlerFunc", ")", "{", "// Let secure process the request. If it returns an error,", "// that i...
// HandlerFuncWithNext is a special implementation for Negroni, but could be used elsewhere.
[ "HandlerFuncWithNext", "is", "a", "special", "implementation", "for", "Negroni", "but", "could", "be", "used", "elsewhere", "." ]
4e32686ccfd4360eba208873a5c397fef3b50cc4
https://github.com/unrolled/secure/blob/4e32686ccfd4360eba208873a5c397fef3b50cc4/secure.go#L192-L202
28,876
unrolled/secure
secure.go
HandlerFuncWithNextForRequestOnly
func (s *Secure) HandlerFuncWithNextForRequestOnly(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { // Let secure process the request. If it returns an error, // that indicates the request should not continue. responseHeader, r, err := s.processRequest(w, r) // If there was an error, do not call ne...
go
func (s *Secure) HandlerFuncWithNextForRequestOnly(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { // Let secure process the request. If it returns an error, // that indicates the request should not continue. responseHeader, r, err := s.processRequest(w, r) // If there was an error, do not call ne...
[ "func", "(", "s", "*", "Secure", ")", "HandlerFuncWithNextForRequestOnly", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "next", "http", ".", "HandlerFunc", ")", "{", "// Let secure process the request. If it returns an error,"...
// HandlerFuncWithNextForRequestOnly is a special implementation for Negroni, but could be used elsewhere. // Note that this is for requests only and will not write any headers.
[ "HandlerFuncWithNextForRequestOnly", "is", "a", "special", "implementation", "for", "Negroni", "but", "could", "be", "used", "elsewhere", ".", "Note", "that", "this", "is", "for", "requests", "only", "and", "will", "not", "write", "any", "headers", "." ]
4e32686ccfd4360eba208873a5c397fef3b50cc4
https://github.com/unrolled/secure/blob/4e32686ccfd4360eba208873a5c397fef3b50cc4/secure.go#L206-L219
28,877
unrolled/secure
secure.go
addResponseHeaders
func addResponseHeaders(responseHeader http.Header, w http.ResponseWriter) { if responseHeader != nil { for key, values := range responseHeader { for _, value := range values { w.Header().Set(key, value) } } } }
go
func addResponseHeaders(responseHeader http.Header, w http.ResponseWriter) { if responseHeader != nil { for key, values := range responseHeader { for _, value := range values { w.Header().Set(key, value) } } } }
[ "func", "addResponseHeaders", "(", "responseHeader", "http", ".", "Header", ",", "w", "http", ".", "ResponseWriter", ")", "{", "if", "responseHeader", "!=", "nil", "{", "for", "key", ",", "values", ":=", "range", "responseHeader", "{", "for", "_", ",", "va...
// addResponseHeaders Adds the headers from 'responseHeader' to the response.
[ "addResponseHeaders", "Adds", "the", "headers", "from", "responseHeader", "to", "the", "response", "." ]
4e32686ccfd4360eba208873a5c397fef3b50cc4
https://github.com/unrolled/secure/blob/4e32686ccfd4360eba208873a5c397fef3b50cc4/secure.go#L222-L230
28,878
unrolled/secure
secure.go
Process
func (s *Secure) Process(w http.ResponseWriter, r *http.Request) error { responseHeader, _, err := s.processRequest(w, r) addResponseHeaders(responseHeader, w) return err }
go
func (s *Secure) Process(w http.ResponseWriter, r *http.Request) error { responseHeader, _, err := s.processRequest(w, r) addResponseHeaders(responseHeader, w) return err }
[ "func", "(", "s", "*", "Secure", ")", "Process", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "error", "{", "responseHeader", ",", "_", ",", "err", ":=", "s", ".", "processRequest", "(", "w", ",", "r", ")", ...
// Process runs the actual checks and writes the headers in the ResponseWriter.
[ "Process", "runs", "the", "actual", "checks", "and", "writes", "the", "headers", "in", "the", "ResponseWriter", "." ]
4e32686ccfd4360eba208873a5c397fef3b50cc4
https://github.com/unrolled/secure/blob/4e32686ccfd4360eba208873a5c397fef3b50cc4/secure.go#L233-L238
28,879
unrolled/secure
secure.go
ProcessNoModifyRequest
func (s *Secure) ProcessNoModifyRequest(w http.ResponseWriter, r *http.Request) (http.Header, *http.Request, error) { return s.processRequest(w, r) }
go
func (s *Secure) ProcessNoModifyRequest(w http.ResponseWriter, r *http.Request) (http.Header, *http.Request, error) { return s.processRequest(w, r) }
[ "func", "(", "s", "*", "Secure", ")", "ProcessNoModifyRequest", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "(", "http", ".", "Header", ",", "*", "http", ".", "Request", ",", "error", ")", "{", "return", "s", ...
// ProcessNoModifyRequest runs the actual checks but does not write the headers in the ResponseWriter.
[ "ProcessNoModifyRequest", "runs", "the", "actual", "checks", "but", "does", "not", "write", "the", "headers", "in", "the", "ResponseWriter", "." ]
4e32686ccfd4360eba208873a5c397fef3b50cc4
https://github.com/unrolled/secure/blob/4e32686ccfd4360eba208873a5c397fef3b50cc4/secure.go#L241-L243
28,880
unrolled/secure
secure.go
isSSL
func (s *Secure) isSSL(r *http.Request) bool { ssl := strings.EqualFold(r.URL.Scheme, "https") || r.TLS != nil if !ssl { for k, v := range s.opt.SSLProxyHeaders { if r.Header.Get(k) == v { ssl = true break } } } return ssl }
go
func (s *Secure) isSSL(r *http.Request) bool { ssl := strings.EqualFold(r.URL.Scheme, "https") || r.TLS != nil if !ssl { for k, v := range s.opt.SSLProxyHeaders { if r.Header.Get(k) == v { ssl = true break } } } return ssl }
[ "func", "(", "s", "*", "Secure", ")", "isSSL", "(", "r", "*", "http", ".", "Request", ")", "bool", "{", "ssl", ":=", "strings", ".", "EqualFold", "(", "r", ".", "URL", ".", "Scheme", ",", "\"", "\"", ")", "||", "r", ".", "TLS", "!=", "nil", "...
// isSSL determine if we are on HTTPS.
[ "isSSL", "determine", "if", "we", "are", "on", "HTTPS", "." ]
4e32686ccfd4360eba208873a5c397fef3b50cc4
https://github.com/unrolled/secure/blob/4e32686ccfd4360eba208873a5c397fef3b50cc4/secure.go#L415-L426
28,881
unrolled/secure
secure.go
ModifyResponseHeaders
func (s *Secure) ModifyResponseHeaders(res *http.Response) error { if res != nil && res.Request != nil { responseHeader := res.Request.Context().Value(ctxSecureHeaderKey) if responseHeader != nil { for header, values := range responseHeader.(http.Header) { if len(values) > 0 { res.Header.Set(header, st...
go
func (s *Secure) ModifyResponseHeaders(res *http.Response) error { if res != nil && res.Request != nil { responseHeader := res.Request.Context().Value(ctxSecureHeaderKey) if responseHeader != nil { for header, values := range responseHeader.(http.Header) { if len(values) > 0 { res.Header.Set(header, st...
[ "func", "(", "s", "*", "Secure", ")", "ModifyResponseHeaders", "(", "res", "*", "http", ".", "Response", ")", "error", "{", "if", "res", "!=", "nil", "&&", "res", ".", "Request", "!=", "nil", "{", "responseHeader", ":=", "res", ".", "Request", ".", "...
// ModifyResponseHeaders modifies the Response. // Used by http.ReverseProxy.
[ "ModifyResponseHeaders", "modifies", "the", "Response", ".", "Used", "by", "http", ".", "ReverseProxy", "." ]
4e32686ccfd4360eba208873a5c397fef3b50cc4
https://github.com/unrolled/secure/blob/4e32686ccfd4360eba208873a5c397fef3b50cc4/secure.go#L430-L442
28,882
labstack/gommon
color/color.go
New
func New() (c *Color) { c = new(Color) c.SetOutput(colorable.NewColorableStdout()) return }
go
func New() (c *Color) { c = new(Color) c.SetOutput(colorable.NewColorableStdout()) return }
[ "func", "New", "(", ")", "(", "c", "*", "Color", ")", "{", "c", "=", "new", "(", "Color", ")", "\n", "c", ".", "SetOutput", "(", "colorable", ".", "NewColorableStdout", "(", ")", ")", "\n", "return", "\n", "}" ]
// New creates a Color instance.
[ "New", "creates", "a", "Color", "instance", "." ]
82ef680aef5189b68682876cf70d09daa4ac0f51
https://github.com/labstack/gommon/blob/82ef680aef5189b68682876cf70d09daa4ac0f51/color/color.go#L132-L136
28,883
labstack/gommon
color/color.go
SetOutput
func (c *Color) SetOutput(w io.Writer) { c.output = w if w, ok := w.(*os.File); !ok || !isatty.IsTerminal(w.Fd()) { c.disabled = true } }
go
func (c *Color) SetOutput(w io.Writer) { c.output = w if w, ok := w.(*os.File); !ok || !isatty.IsTerminal(w.Fd()) { c.disabled = true } }
[ "func", "(", "c", "*", "Color", ")", "SetOutput", "(", "w", "io", ".", "Writer", ")", "{", "c", ".", "output", "=", "w", "\n", "if", "w", ",", "ok", ":=", "w", ".", "(", "*", "os", ".", "File", ")", ";", "!", "ok", "||", "!", "isatty", "....
// SetOutput sets the output.
[ "SetOutput", "sets", "the", "output", "." ]
82ef680aef5189b68682876cf70d09daa4ac0f51
https://github.com/labstack/gommon/blob/82ef680aef5189b68682876cf70d09daa4ac0f51/color/color.go#L144-L149
28,884
labstack/gommon
color/color.go
Printf
func (c *Color) Printf(format string, args ...interface{}) { fmt.Fprintf(c.output, format, args...) }
go
func (c *Color) Printf(format string, args ...interface{}) { fmt.Fprintf(c.output, format, args...) }
[ "func", "(", "c", "*", "Color", ")", "Printf", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "fmt", ".", "Fprintf", "(", "c", ".", "output", ",", "format", ",", "args", "...", ")", "\n", "}" ]
// Printf is analogous to `fmt.Printf` with termial detection.
[ "Printf", "is", "analogous", "to", "fmt", ".", "Printf", "with", "termial", "detection", "." ]
82ef680aef5189b68682876cf70d09daa4ac0f51
https://github.com/labstack/gommon/blob/82ef680aef5189b68682876cf70d09daa4ac0f51/color/color.go#L172-L174
28,885
caarlos0/env
env.go
ParseWithFuncs
func ParseWithFuncs(v interface{}, funcMap CustomParsers) error { ptrRef := reflect.ValueOf(v) if ptrRef.Kind() != reflect.Ptr { return ErrNotAStructPtr } ref := ptrRef.Elem() if ref.Kind() != reflect.Struct { return ErrNotAStructPtr } var parsers = defaultCustomParsers() for k, v := range funcMap { parse...
go
func ParseWithFuncs(v interface{}, funcMap CustomParsers) error { ptrRef := reflect.ValueOf(v) if ptrRef.Kind() != reflect.Ptr { return ErrNotAStructPtr } ref := ptrRef.Elem() if ref.Kind() != reflect.Struct { return ErrNotAStructPtr } var parsers = defaultCustomParsers() for k, v := range funcMap { parse...
[ "func", "ParseWithFuncs", "(", "v", "interface", "{", "}", ",", "funcMap", "CustomParsers", ")", "error", "{", "ptrRef", ":=", "reflect", ".", "ValueOf", "(", "v", ")", "\n", "if", "ptrRef", ".", "Kind", "(", ")", "!=", "reflect", ".", "Ptr", "{", "r...
// ParseWithFuncs is the same as `Parse` except it also allows the user to pass // in custom parsers.
[ "ParseWithFuncs", "is", "the", "same", "as", "Parse", "except", "it", "also", "allows", "the", "user", "to", "pass", "in", "custom", "parsers", "." ]
2ae6b6e118789b55aae151656169a4a07d4bff42
https://github.com/caarlos0/env/blob/2ae6b6e118789b55aae151656169a4a07d4bff42/env.go#L98-L112
28,886
caarlos0/env
env.go
parseKeyForOption
func parseKeyForOption(key string) (string, []string) { opts := strings.Split(key, ",") return opts[0], opts[1:] }
go
func parseKeyForOption(key string) (string, []string) { opts := strings.Split(key, ",") return opts[0], opts[1:] }
[ "func", "parseKeyForOption", "(", "key", "string", ")", "(", "string", ",", "[", "]", "string", ")", "{", "opts", ":=", "strings", ".", "Split", "(", "key", ",", "\"", "\"", ")", "\n", "return", "opts", "[", "0", "]", ",", "opts", "[", "1", ":", ...
// split the env tag's key into the expected key and desired option, if any.
[ "split", "the", "env", "tag", "s", "key", "into", "the", "expected", "key", "and", "desired", "option", "if", "any", "." ]
2ae6b6e118789b55aae151656169a4a07d4bff42
https://github.com/caarlos0/env/blob/2ae6b6e118789b55aae151656169a4a07d4bff42/env.go#L183-L186
28,887
go-gl/glfw
v3.2/glfw/native_windows.go
GetWin32Adapter
func (m *Monitor) GetWin32Adapter() string { ret := C.glfwGetWin32Adapter(m.data) panicError() return C.GoString(ret) }
go
func (m *Monitor) GetWin32Adapter() string { ret := C.glfwGetWin32Adapter(m.data) panicError() return C.GoString(ret) }
[ "func", "(", "m", "*", "Monitor", ")", "GetWin32Adapter", "(", ")", "string", "{", "ret", ":=", "C", ".", "glfwGetWin32Adapter", "(", "m", ".", "data", ")", "\n", "panicError", "(", ")", "\n", "return", "C", ".", "GoString", "(", "ret", ")", "\n", ...
// GetWin32Adapter returns the adapter device name of the monitor.
[ "GetWin32Adapter", "returns", "the", "adapter", "device", "name", "of", "the", "monitor", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/native_windows.go#L11-L15
28,888
go-gl/glfw
v3.2/glfw/native_windows.go
GetWin32Monitor
func (m *Monitor) GetWin32Monitor() string { ret := C.glfwGetWin32Monitor(m.data) panicError() return C.GoString(ret) }
go
func (m *Monitor) GetWin32Monitor() string { ret := C.glfwGetWin32Monitor(m.data) panicError() return C.GoString(ret) }
[ "func", "(", "m", "*", "Monitor", ")", "GetWin32Monitor", "(", ")", "string", "{", "ret", ":=", "C", ".", "glfwGetWin32Monitor", "(", "m", ".", "data", ")", "\n", "panicError", "(", ")", "\n", "return", "C", ".", "GoString", "(", "ret", ")", "\n", ...
// GetWin32Monitor returns the display device name of the monitor.
[ "GetWin32Monitor", "returns", "the", "display", "device", "name", "of", "the", "monitor", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/native_windows.go#L18-L22
28,889
go-gl/glfw
v3.2/glfw/native_windows.go
GetWin32Window
func (w *Window) GetWin32Window() C.HWND { ret := C.glfwGetWin32Window(w.data) panicError() return ret }
go
func (w *Window) GetWin32Window() C.HWND { ret := C.glfwGetWin32Window(w.data) panicError() return ret }
[ "func", "(", "w", "*", "Window", ")", "GetWin32Window", "(", ")", "C", ".", "HWND", "{", "ret", ":=", "C", ".", "glfwGetWin32Window", "(", "w", ".", "data", ")", "\n", "panicError", "(", ")", "\n", "return", "ret", "\n", "}" ]
// GetWin32Window returns the HWND of the window.
[ "GetWin32Window", "returns", "the", "HWND", "of", "the", "window", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/native_windows.go#L25-L29
28,890
go-gl/glfw
v3.2/glfw/native_windows.go
GetWGLContext
func (w *Window) GetWGLContext() C.HGLRC { ret := C.glfwGetWGLContext(w.data) panicError() return ret }
go
func (w *Window) GetWGLContext() C.HGLRC { ret := C.glfwGetWGLContext(w.data) panicError() return ret }
[ "func", "(", "w", "*", "Window", ")", "GetWGLContext", "(", ")", "C", ".", "HGLRC", "{", "ret", ":=", "C", ".", "glfwGetWGLContext", "(", "w", ".", "data", ")", "\n", "panicError", "(", ")", "\n", "return", "ret", "\n", "}" ]
// GetWGLContext returns the HGLRC of the window.
[ "GetWGLContext", "returns", "the", "HGLRC", "of", "the", "window", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/native_windows.go#L32-L36
28,891
go-gl/glfw
v3.0/glfw/monitor.go
GetPosition
func (m *Monitor) GetPosition() (x, y int) { var xpos, ypos C.int C.glfwGetMonitorPos(m.data, &xpos, &ypos) return int(xpos), int(ypos) }
go
func (m *Monitor) GetPosition() (x, y int) { var xpos, ypos C.int C.glfwGetMonitorPos(m.data, &xpos, &ypos) return int(xpos), int(ypos) }
[ "func", "(", "m", "*", "Monitor", ")", "GetPosition", "(", ")", "(", "x", ",", "y", "int", ")", "{", "var", "xpos", ",", "ypos", "C", ".", "int", "\n\n", "C", ".", "glfwGetMonitorPos", "(", "m", ".", "data", ",", "&", "xpos", ",", "&", "ypos", ...
//GetPosition returns the position, in screen coordinates, of the upper-left //corner of the monitor.
[ "GetPosition", "returns", "the", "position", "in", "screen", "coordinates", "of", "the", "upper", "-", "left", "corner", "of", "the", "monitor", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/monitor.go#L86-L91
28,892
go-gl/glfw
v3.0/glfw/monitor.go
SetGamma
func (m *Monitor) SetGamma(gamma float32) { C.glfwSetGamma(m.data, C.float(gamma)) }
go
func (m *Monitor) SetGamma(gamma float32) { C.glfwSetGamma(m.data, C.float(gamma)) }
[ "func", "(", "m", "*", "Monitor", ")", "SetGamma", "(", "gamma", "float32", ")", "{", "C", ".", "glfwSetGamma", "(", "m", ".", "data", ",", "C", ".", "float", "(", "gamma", ")", ")", "\n", "}" ]
//SetGamma generates a 256-element gamma ramp from the specified exponent and then calls //SetGamma with it.
[ "SetGamma", "generates", "a", "256", "-", "element", "gamma", "ramp", "from", "the", "specified", "exponent", "and", "then", "calls", "SetGamma", "with", "it", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/monitor.go#L164-L166
28,893
go-gl/glfw
v3.0/glfw/monitor.go
GetGammaRamp
func (m *Monitor) GetGammaRamp() (*GammaRamp, error) { var ramp GammaRamp rampC := C.glfwGetGammaRamp(m.data) if rampC == nil { return nil, errors.New("Can't get the gamma ramp.") } length := int(rampC.size) ramp.Red = make([]uint16, length) ramp.Green = make([]uint16, length) ramp.Blue = make([]uint16, len...
go
func (m *Monitor) GetGammaRamp() (*GammaRamp, error) { var ramp GammaRamp rampC := C.glfwGetGammaRamp(m.data) if rampC == nil { return nil, errors.New("Can't get the gamma ramp.") } length := int(rampC.size) ramp.Red = make([]uint16, length) ramp.Green = make([]uint16, length) ramp.Blue = make([]uint16, len...
[ "func", "(", "m", "*", "Monitor", ")", "GetGammaRamp", "(", ")", "(", "*", "GammaRamp", ",", "error", ")", "{", "var", "ramp", "GammaRamp", "\n\n", "rampC", ":=", "C", ".", "glfwGetGammaRamp", "(", "m", ".", "data", ")", "\n", "if", "rampC", "==", ...
//GetGammaRamp retrieves the current gamma ramp of the monitor.
[ "GetGammaRamp", "retrieves", "the", "current", "gamma", "ramp", "of", "the", "monitor", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/monitor.go#L169-L189
28,894
go-gl/glfw
v3.0/glfw/monitor.go
SetGammaRamp
func (m *Monitor) SetGammaRamp(ramp *GammaRamp) { var rampC C.GLFWgammaramp length := len(ramp.Red) for i := 0; i < length; i++ { C.SetGammaAtIndex(rampC.red, C.int(i), C.ushort(ramp.Red[i])) C.SetGammaAtIndex(rampC.green, C.int(i), C.ushort(ramp.Green[i])) C.SetGammaAtIndex(rampC.blue, C.int(i), C.ushort(ra...
go
func (m *Monitor) SetGammaRamp(ramp *GammaRamp) { var rampC C.GLFWgammaramp length := len(ramp.Red) for i := 0; i < length; i++ { C.SetGammaAtIndex(rampC.red, C.int(i), C.ushort(ramp.Red[i])) C.SetGammaAtIndex(rampC.green, C.int(i), C.ushort(ramp.Green[i])) C.SetGammaAtIndex(rampC.blue, C.int(i), C.ushort(ra...
[ "func", "(", "m", "*", "Monitor", ")", "SetGammaRamp", "(", "ramp", "*", "GammaRamp", ")", "{", "var", "rampC", "C", ".", "GLFWgammaramp", "\n\n", "length", ":=", "len", "(", "ramp", ".", "Red", ")", "\n\n", "for", "i", ":=", "0", ";", "i", "<", ...
//SetGammaRamp sets the current gamma ramp for the monitor.
[ "SetGammaRamp", "sets", "the", "current", "gamma", "ramp", "for", "the", "monitor", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.0/glfw/monitor.go#L192-L204
28,895
go-gl/glfw
v3.2/glfw/input.go
GetInputMode
func (w *Window) GetInputMode(mode InputMode) int { ret := int(C.glfwGetInputMode(w.data, C.int(mode))) panicError() return ret }
go
func (w *Window) GetInputMode(mode InputMode) int { ret := int(C.glfwGetInputMode(w.data, C.int(mode))) panicError() return ret }
[ "func", "(", "w", "*", "Window", ")", "GetInputMode", "(", "mode", "InputMode", ")", "int", "{", "ret", ":=", "int", "(", "C", ".", "glfwGetInputMode", "(", "w", ".", "data", ",", "C", ".", "int", "(", "mode", ")", ")", ")", "\n", "panicError", "...
// GetInputMode returns the value of an input option of the window.
[ "GetInputMode", "returns", "the", "value", "of", "an", "input", "option", "of", "the", "window", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/input.go#L317-L321
28,896
go-gl/glfw
v3.2/glfw/input.go
SetInputMode
func (w *Window) SetInputMode(mode InputMode, value int) { C.glfwSetInputMode(w.data, C.int(mode), C.int(value)) panicError() }
go
func (w *Window) SetInputMode(mode InputMode, value int) { C.glfwSetInputMode(w.data, C.int(mode), C.int(value)) panicError() }
[ "func", "(", "w", "*", "Window", ")", "SetInputMode", "(", "mode", "InputMode", ",", "value", "int", ")", "{", "C", ".", "glfwSetInputMode", "(", "w", ".", "data", ",", "C", ".", "int", "(", "mode", ")", ",", "C", ".", "int", "(", "value", ")", ...
// SetInputMode sets an input option for the window.
[ "SetInputMode", "sets", "an", "input", "option", "for", "the", "window", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/input.go#L324-L327
28,897
go-gl/glfw
v3.2/glfw/input.go
GetKeyName
func GetKeyName(key Key, scancode int) string { ret := C.glfwGetKeyName(C.int(key), C.int(scancode)) panicError() return C.GoString(ret) }
go
func GetKeyName(key Key, scancode int) string { ret := C.glfwGetKeyName(C.int(key), C.int(scancode)) panicError() return C.GoString(ret) }
[ "func", "GetKeyName", "(", "key", "Key", ",", "scancode", "int", ")", "string", "{", "ret", ":=", "C", ".", "glfwGetKeyName", "(", "C", ".", "int", "(", "key", ")", ",", "C", ".", "int", "(", "scancode", ")", ")", "\n", "panicError", "(", ")", "\...
// GetKeyName returns the localized name of the specified printable key. // // If the key is glfw.KeyUnknown, the scancode is used, otherwise the scancode is ignored.
[ "GetKeyName", "returns", "the", "localized", "name", "of", "the", "specified", "printable", "key", ".", "If", "the", "key", "is", "glfw", ".", "KeyUnknown", "the", "scancode", "is", "used", "otherwise", "the", "scancode", "is", "ignored", "." ]
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/input.go#L349-L353
28,898
go-gl/glfw
v3.2/glfw/input.go
SetCursor
func (w *Window) SetCursor(c *Cursor) { if c == nil { C.glfwSetCursor(w.data, nil) } else { C.glfwSetCursor(w.data, c.data) } panicError() }
go
func (w *Window) SetCursor(c *Cursor) { if c == nil { C.glfwSetCursor(w.data, nil) } else { C.glfwSetCursor(w.data, c.data) } panicError() }
[ "func", "(", "w", "*", "Window", ")", "SetCursor", "(", "c", "*", "Cursor", ")", "{", "if", "c", "==", "nil", "{", "C", ".", "glfwSetCursor", "(", "w", ".", "data", ",", "nil", ")", "\n", "}", "else", "{", "C", ".", "glfwSetCursor", "(", "w", ...
// SetCursor sets the cursor image to be used when the cursor is over the client area // of the specified window. The set cursor will only be visible when the cursor mode of the // window is CursorNormal. // // On some platforms, the set cursor may not be visible unless the window also has input focus.
[ "SetCursor", "sets", "the", "cursor", "image", "to", "be", "used", "when", "the", "cursor", "is", "over", "the", "client", "area", "of", "the", "specified", "window", ".", "The", "set", "cursor", "will", "only", "be", "visible", "when", "the", "cursor", ...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/input.go#L451-L458
28,899
go-gl/glfw
v3.2/glfw/input.go
SetJoystickCallback
func SetJoystickCallback(cbfun JoystickCallback) (previous JoystickCallback) { previous = fJoystickHolder fJoystickHolder = cbfun if cbfun == nil { C.glfwSetJoystickCallback(nil) } else { C.glfwSetJoystickCallbackCB() } panicError() return previous }
go
func SetJoystickCallback(cbfun JoystickCallback) (previous JoystickCallback) { previous = fJoystickHolder fJoystickHolder = cbfun if cbfun == nil { C.glfwSetJoystickCallback(nil) } else { C.glfwSetJoystickCallbackCB() } panicError() return previous }
[ "func", "SetJoystickCallback", "(", "cbfun", "JoystickCallback", ")", "(", "previous", "JoystickCallback", ")", "{", "previous", "=", "fJoystickHolder", "\n", "fJoystickHolder", "=", "cbfun", "\n", "if", "cbfun", "==", "nil", "{", "C", ".", "glfwSetJoystickCallbac...
// SetJoystickCallback sets the joystick configuration callback, or removes the // currently set callback. This is called when a joystick is connected to or // disconnected from the system.
[ "SetJoystickCallback", "sets", "the", "joystick", "configuration", "callback", "or", "removes", "the", "currently", "set", "callback", ".", "This", "is", "called", "when", "a", "joystick", "is", "connected", "to", "or", "disconnected", "from", "the", "system", "...
e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc
https://github.com/go-gl/glfw/blob/e6da0acd62b1b57ee2799d4d0a76a7d4514dc5bc/v3.2/glfw/input.go#L466-L476