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
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
146,500
BurntSushi/toml
lex.go
lexDatetime
func lexDatetime(lx *lexer) stateFn { r := lx.next() if isDigit(r) { return lexDatetime } switch r { case '-', 'T', ':', '.', 'Z', '+': return lexDatetime } lx.backup() lx.emit(itemDatetime) return lx.pop() }
go
func lexDatetime(lx *lexer) stateFn { r := lx.next() if isDigit(r) { return lexDatetime } switch r { case '-', 'T', ':', '.', 'Z', '+': return lexDatetime } lx.backup() lx.emit(itemDatetime) return lx.pop() }
[ "func", "lexDatetime", "(", "lx", "*", "lexer", ")", "stateFn", "{", "r", ":=", "lx", ".", "next", "(", ")", "\n", "if", "isDigit", "(", "r", ")", "{", "return", "lexDatetime", "\n", "}", "\n", "switch", "r", "{", "case", "'-'", ",", "'T'", ",", ...
// lexDatetime consumes a Datetime, to a first approximation. // The parser validates that it matches one of the accepted formats.
[ "lexDatetime", "consumes", "a", "Datetime", "to", "a", "first", "approximation", ".", "The", "parser", "validates", "that", "it", "matches", "one", "of", "the", "accepted", "formats", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/lex.go#L772-L785
146,501
BurntSushi/toml
encode.go
NewEncoder
func NewEncoder(w io.Writer) *Encoder { return &Encoder{ w: bufio.NewWriter(w), Indent: " ", } }
go
func NewEncoder(w io.Writer) *Encoder { return &Encoder{ w: bufio.NewWriter(w), Indent: " ", } }
[ "func", "NewEncoder", "(", "w", "io", ".", "Writer", ")", "*", "Encoder", "{", "return", "&", "Encoder", "{", "w", ":", "bufio", ".", "NewWriter", "(", "w", ")", ",", "Indent", ":", "\"", "\"", ",", "}", "\n", "}" ]
// NewEncoder returns a TOML encoder that encodes Go values to the io.Writer // given. By default, a single indentation level is 2 spaces.
[ "NewEncoder", "returns", "a", "TOML", "encoder", "that", "encodes", "Go", "values", "to", "the", "io", ".", "Writer", "given", ".", "By", "default", "a", "single", "indentation", "level", "is", "2", "spaces", "." ]
3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
https://github.com/BurntSushi/toml/blob/3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005/encode.go#L56-L61
146,502
bluele/gcache
lru.go
evict
func (c *LRUCache) evict(count int) { for i := 0; i < count; i++ { ent := c.evictList.Back() if ent == nil { return } else { c.removeElement(ent) } } }
go
func (c *LRUCache) evict(count int) { for i := 0; i < count; i++ { ent := c.evictList.Back() if ent == nil { return } else { c.removeElement(ent) } } }
[ "func", "(", "c", "*", "LRUCache", ")", "evict", "(", "count", "int", ")", "{", "for", "i", ":=", "0", ";", "i", "<", "count", ";", "i", "++", "{", "ent", ":=", "c", ".", "evictList", ".", "Back", "(", ")", "\n", "if", "ent", "==", "nil", "...
// evict removes the oldest item from the cache.
[ "evict", "removes", "the", "oldest", "item", "from", "the", "cache", "." ]
79ae3b2d8680cbc7ad3dba9db66b8a648575221c
https://github.com/bluele/gcache/blob/79ae3b2d8680cbc7ad3dba9db66b8a648575221c/lru.go#L174-L183
146,503
bluele/gcache
arc.go
Has
func (c *ARC) Has(key interface{}) bool { c.mu.RLock() defer c.mu.RUnlock() now := time.Now() return c.has(key, &now) }
go
func (c *ARC) Has(key interface{}) bool { c.mu.RLock() defer c.mu.RUnlock() now := time.Now() return c.has(key, &now) }
[ "func", "(", "c", "*", "ARC", ")", "Has", "(", "key", "interface", "{", "}", ")", "bool", "{", "c", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "RUnlock", "(", ")", "\n", "now", ":=", "time", ".", "Now", "(", ")",...
// Has checks if key exists in cache
[ "Has", "checks", "if", "key", "exists", "in", "cache" ]
79ae3b2d8680cbc7ad3dba9db66b8a648575221c
https://github.com/bluele/gcache/blob/79ae3b2d8680cbc7ad3dba9db66b8a648575221c/arc.go#L267-L272
146,504
bluele/gcache
arc.go
Keys
func (c *ARC) Keys() []interface{} { keys := []interface{}{} for _, k := range c.keys() { _, err := c.GetIFPresent(k) if err == nil { keys = append(keys, k) } } return keys }
go
func (c *ARC) Keys() []interface{} { keys := []interface{}{} for _, k := range c.keys() { _, err := c.GetIFPresent(k) if err == nil { keys = append(keys, k) } } return keys }
[ "func", "(", "c", "*", "ARC", ")", "Keys", "(", ")", "[", "]", "interface", "{", "}", "{", "keys", ":=", "[", "]", "interface", "{", "}", "{", "}", "\n", "for", "_", ",", "k", ":=", "range", "c", ".", "keys", "(", ")", "{", "_", ",", "err...
// Keys returns a slice of the keys in the cache.
[ "Keys", "returns", "a", "slice", "of", "the", "keys", "in", "the", "cache", "." ]
79ae3b2d8680cbc7ad3dba9db66b8a648575221c
https://github.com/bluele/gcache/blob/79ae3b2d8680cbc7ad3dba9db66b8a648575221c/arc.go#L329-L338
146,505
bluele/gcache
arc.go
GetALL
func (c *ARC) GetALL() map[interface{}]interface{} { m := make(map[interface{}]interface{}) for _, k := range c.keys() { v, err := c.GetIFPresent(k) if err == nil { m[k] = v } } return m }
go
func (c *ARC) GetALL() map[interface{}]interface{} { m := make(map[interface{}]interface{}) for _, k := range c.keys() { v, err := c.GetIFPresent(k) if err == nil { m[k] = v } } return m }
[ "func", "(", "c", "*", "ARC", ")", "GetALL", "(", ")", "map", "[", "interface", "{", "}", "]", "interface", "{", "}", "{", "m", ":=", "make", "(", "map", "[", "interface", "{", "}", "]", "interface", "{", "}", ")", "\n", "for", "_", ",", "k",...
// GetALL returns all key-value pairs in the cache.
[ "GetALL", "returns", "all", "key", "-", "value", "pairs", "in", "the", "cache", "." ]
79ae3b2d8680cbc7ad3dba9db66b8a648575221c
https://github.com/bluele/gcache/blob/79ae3b2d8680cbc7ad3dba9db66b8a648575221c/arc.go#L341-L350
146,506
bluele/gcache
lfu.go
Set
func (c *LFUCache) Set(key, value interface{}) error { c.mu.Lock() defer c.mu.Unlock() _, err := c.set(key, value) return err }
go
func (c *LFUCache) Set(key, value interface{}) error { c.mu.Lock() defer c.mu.Unlock() _, err := c.set(key, value) return err }
[ "func", "(", "c", "*", "LFUCache", ")", "Set", "(", "key", ",", "value", "interface", "{", "}", ")", "error", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "_", ",", "err", ":=", "...
// Set a new key-value pair
[ "Set", "a", "new", "key", "-", "value", "pair" ]
79ae3b2d8680cbc7ad3dba9db66b8a648575221c
https://github.com/bluele/gcache/blob/79ae3b2d8680cbc7ad3dba9db66b8a648575221c/lfu.go#L34-L39
146,507
bluele/gcache
lfu.go
SetWithExpire
func (c *LFUCache) SetWithExpire(key, value interface{}, expiration time.Duration) error { c.mu.Lock() defer c.mu.Unlock() item, err := c.set(key, value) if err != nil { return err } t := c.clock.Now().Add(expiration) item.(*lfuItem).expiration = &t return nil }
go
func (c *LFUCache) SetWithExpire(key, value interface{}, expiration time.Duration) error { c.mu.Lock() defer c.mu.Unlock() item, err := c.set(key, value) if err != nil { return err } t := c.clock.Now().Add(expiration) item.(*lfuItem).expiration = &t return nil }
[ "func", "(", "c", "*", "LFUCache", ")", "SetWithExpire", "(", "key", ",", "value", "interface", "{", "}", ",", "expiration", "time", ".", "Duration", ")", "error", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "U...
// Set a new key-value pair with an expiration time
[ "Set", "a", "new", "key", "-", "value", "pair", "with", "an", "expiration", "time" ]
79ae3b2d8680cbc7ad3dba9db66b8a648575221c
https://github.com/bluele/gcache/blob/79ae3b2d8680cbc7ad3dba9db66b8a648575221c/lfu.go#L42-L53
146,508
bluele/gcache
lfu.go
Get
func (c *LFUCache) Get(key interface{}) (interface{}, error) { v, err := c.get(key, false) if err == KeyNotFoundError { return c.getWithLoader(key, true) } return v, err }
go
func (c *LFUCache) Get(key interface{}) (interface{}, error) { v, err := c.get(key, false) if err == KeyNotFoundError { return c.getWithLoader(key, true) } return v, err }
[ "func", "(", "c", "*", "LFUCache", ")", "Get", "(", "key", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "v", ",", "err", ":=", "c", ".", "get", "(", "key", ",", "false", ")", "\n", "if", "err", "==", "KeyNot...
// Get a value from cache pool using key if it exists. // If it dose not exists key and has LoaderFunc, // generate a value using `LoaderFunc` method returns value.
[ "Get", "a", "value", "from", "cache", "pool", "using", "key", "if", "it", "exists", ".", "If", "it", "dose", "not", "exists", "key", "and", "has", "LoaderFunc", "generate", "a", "value", "using", "LoaderFunc", "method", "returns", "value", "." ]
79ae3b2d8680cbc7ad3dba9db66b8a648575221c
https://github.com/bluele/gcache/blob/79ae3b2d8680cbc7ad3dba9db66b8a648575221c/lfu.go#L102-L108
146,509
bluele/gcache
lfu.go
evict
func (c *LFUCache) evict(count int) { entry := c.freqList.Front() for i := 0; i < count; { if entry == nil { return } else { for item, _ := range entry.Value.(*freqEntry).items { if i >= count { return } c.removeItem(item) i++ } entry = entry.Next() } } }
go
func (c *LFUCache) evict(count int) { entry := c.freqList.Front() for i := 0; i < count; { if entry == nil { return } else { for item, _ := range entry.Value.(*freqEntry).items { if i >= count { return } c.removeItem(item) i++ } entry = entry.Next() } } }
[ "func", "(", "c", "*", "LFUCache", ")", "evict", "(", "count", "int", ")", "{", "entry", ":=", "c", ".", "freqList", ".", "Front", "(", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "count", ";", "{", "if", "entry", "==", "nil", "{", "retu...
// evict removes the least frequence item from the cache.
[ "evict", "removes", "the", "least", "frequence", "item", "from", "the", "cache", "." ]
79ae3b2d8680cbc7ad3dba9db66b8a648575221c
https://github.com/bluele/gcache/blob/79ae3b2d8680cbc7ad3dba9db66b8a648575221c/lfu.go#L198-L214
146,510
bluele/gcache
stats.go
HitRate
func (st *stats) HitRate() float64 { hc, mc := st.HitCount(), st.MissCount() total := hc + mc if total == 0 { return 0.0 } return float64(hc) / float64(total) }
go
func (st *stats) HitRate() float64 { hc, mc := st.HitCount(), st.MissCount() total := hc + mc if total == 0 { return 0.0 } return float64(hc) / float64(total) }
[ "func", "(", "st", "*", "stats", ")", "HitRate", "(", ")", "float64", "{", "hc", ",", "mc", ":=", "st", ".", "HitCount", "(", ")", ",", "st", ".", "MissCount", "(", ")", "\n", "total", ":=", "hc", "+", "mc", "\n", "if", "total", "==", "0", "{...
// HitRate returns rate for cache hitting
[ "HitRate", "returns", "rate", "for", "cache", "hitting" ]
79ae3b2d8680cbc7ad3dba9db66b8a648575221c
https://github.com/bluele/gcache/blob/79ae3b2d8680cbc7ad3dba9db66b8a648575221c/stats.go#L46-L53
146,511
bluele/gcache
cache.go
load
func (c *baseCache) load(key interface{}, cb func(interface{}, *time.Duration, error) (interface{}, error), isWait bool) (interface{}, bool, error) { v, called, err := c.loadGroup.Do(key, func() (v interface{}, e error) { defer func() { if r := recover(); r != nil { e = fmt.Errorf("Loader panics: %v", r) }...
go
func (c *baseCache) load(key interface{}, cb func(interface{}, *time.Duration, error) (interface{}, error), isWait bool) (interface{}, bool, error) { v, called, err := c.loadGroup.Do(key, func() (v interface{}, e error) { defer func() { if r := recover(); r != nil { e = fmt.Errorf("Loader panics: %v", r) }...
[ "func", "(", "c", "*", "baseCache", ")", "load", "(", "key", "interface", "{", "}", ",", "cb", "func", "(", "interface", "{", "}", ",", "*", "time", ".", "Duration", ",", "error", ")", "(", "interface", "{", "}", ",", "error", ")", ",", "isWait",...
// load a new value using by specified key.
[ "load", "a", "new", "value", "using", "by", "specified", "key", "." ]
79ae3b2d8680cbc7ad3dba9db66b8a648575221c
https://github.com/bluele/gcache/blob/79ae3b2d8680cbc7ad3dba9db66b8a648575221c/cache.go#L192-L205
146,512
bitly/oauth2_proxy
options.go
secretBytes
func secretBytes(secret string) []byte { b, err := base64.URLEncoding.DecodeString(addPadding(secret)) if err == nil { return []byte(addPadding(string(b))) } return []byte(secret) }
go
func secretBytes(secret string) []byte { b, err := base64.URLEncoding.DecodeString(addPadding(secret)) if err == nil { return []byte(addPadding(string(b))) } return []byte(secret) }
[ "func", "secretBytes", "(", "secret", "string", ")", "[", "]", "byte", "{", "b", ",", "err", ":=", "base64", ".", "URLEncoding", ".", "DecodeString", "(", "addPadding", "(", "secret", ")", ")", "\n", "if", "err", "==", "nil", "{", "return", "[", "]",...
// secretBytes attempts to base64 decode the secret, if that fails it treats the secret as binary
[ "secretBytes", "attempts", "to", "base64", "decode", "the", "secret", "if", "that", "fails", "it", "treats", "the", "secret", "as", "binary" ]
fa2771998a98a5bfdfa3c3503757668ac4f1c8ec
https://github.com/bitly/oauth2_proxy/blob/fa2771998a98a5bfdfa3c3503757668ac4f1c8ec/options.go#L329-L335
146,513
bitly/oauth2_proxy
providers/internal_util.go
stripParam
func stripParam(param, endpoint string) string { u, err := url.Parse(endpoint) if err != nil { log.Printf("error attempting to strip %s: %s", param, err) return endpoint } if u.RawQuery != "" { values, err := url.ParseQuery(u.RawQuery) if err != nil { log.Printf("error attempting to strip %s: %s", param...
go
func stripParam(param, endpoint string) string { u, err := url.Parse(endpoint) if err != nil { log.Printf("error attempting to strip %s: %s", param, err) return endpoint } if u.RawQuery != "" { values, err := url.ParseQuery(u.RawQuery) if err != nil { log.Printf("error attempting to strip %s: %s", param...
[ "func", "stripParam", "(", "param", ",", "endpoint", "string", ")", "string", "{", "u", ",", "err", ":=", "url", ".", "Parse", "(", "endpoint", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "param", ",", "e...
// stripParam generalizes the obfuscation of a particular // query parameter - typically 'access_token' or 'client_secret' // The parameter's second half is replaced by '...' and returned // as part of the encoded query parameters. // If the target parameter isn't found, the endpoint is returned // unmodified.
[ "stripParam", "generalizes", "the", "obfuscation", "of", "a", "particular", "query", "parameter", "-", "typically", "access_token", "or", "client_secret", "The", "parameter", "s", "second", "half", "is", "replaced", "by", "...", "and", "returned", "as", "part", ...
fa2771998a98a5bfdfa3c3503757668ac4f1c8ec
https://github.com/bitly/oauth2_proxy/blob/fa2771998a98a5bfdfa3c3503757668ac4f1c8ec/providers/internal_util.go#L24-L46
146,514
bitly/oauth2_proxy
providers/internal_util.go
validateToken
func validateToken(p Provider, access_token string, header http.Header) bool { if access_token == "" || p.Data().ValidateURL == nil { return false } endpoint := p.Data().ValidateURL.String() if len(header) == 0 { params := url.Values{"access_token": {access_token}} endpoint = endpoint + "?" + params.Encode() ...
go
func validateToken(p Provider, access_token string, header http.Header) bool { if access_token == "" || p.Data().ValidateURL == nil { return false } endpoint := p.Data().ValidateURL.String() if len(header) == 0 { params := url.Values{"access_token": {access_token}} endpoint = endpoint + "?" + params.Encode() ...
[ "func", "validateToken", "(", "p", "Provider", ",", "access_token", "string", ",", "header", "http", ".", "Header", ")", "bool", "{", "if", "access_token", "==", "\"", "\"", "||", "p", ".", "Data", "(", ")", ".", "ValidateURL", "==", "nil", "{", "retur...
// validateToken returns true if token is valid
[ "validateToken", "returns", "true", "if", "token", "is", "valid" ]
fa2771998a98a5bfdfa3c3503757668ac4f1c8ec
https://github.com/bitly/oauth2_proxy/blob/fa2771998a98a5bfdfa3c3503757668ac4f1c8ec/providers/internal_util.go#L49-L74
146,515
bitly/oauth2_proxy
logging_handler.go
writeLogLine
func (h loggingHandler) writeLogLine(username, upstream string, req *http.Request, url url.URL, ts time.Time, status int, size int) { if username == "" { username = "-" } if upstream == "" { upstream = "-" } if url.User != nil && username == "-" { if name := url.User.Username(); name != "" { username = na...
go
func (h loggingHandler) writeLogLine(username, upstream string, req *http.Request, url url.URL, ts time.Time, status int, size int) { if username == "" { username = "-" } if upstream == "" { upstream = "-" } if url.User != nil && username == "-" { if name := url.User.Username(); name != "" { username = na...
[ "func", "(", "h", "loggingHandler", ")", "writeLogLine", "(", "username", ",", "upstream", "string", ",", "req", "*", "http", ".", "Request", ",", "url", "url", ".", "URL", ",", "ts", "time", ".", "Time", ",", "status", "int", ",", "size", "int", ")"...
// Log entry for req similar to Apache Common Log Format. // ts is the timestamp with which the entry should be logged. // status, size are used to provide the response HTTP status and size.
[ "Log", "entry", "for", "req", "similar", "to", "Apache", "Common", "Log", "Format", ".", "ts", "is", "the", "timestamp", "with", "which", "the", "entry", "should", "be", "logged", ".", "status", "size", "are", "used", "to", "provide", "the", "response", ...
fa2771998a98a5bfdfa3c3503757668ac4f1c8ec
https://github.com/bitly/oauth2_proxy/blob/fa2771998a98a5bfdfa3c3503757668ac4f1c8ec/logging_handler.go#L120-L160
146,516
bitly/oauth2_proxy
cookie/cookies.go
SignedValue
func SignedValue(seed string, key string, value string, now time.Time) string { encodedValue := base64.URLEncoding.EncodeToString([]byte(value)) timeStr := fmt.Sprintf("%d", now.Unix()) sig := cookieSignature(seed, key, encodedValue, timeStr) cookieVal := fmt.Sprintf("%s|%s|%s", encodedValue, timeStr, sig) return ...
go
func SignedValue(seed string, key string, value string, now time.Time) string { encodedValue := base64.URLEncoding.EncodeToString([]byte(value)) timeStr := fmt.Sprintf("%d", now.Unix()) sig := cookieSignature(seed, key, encodedValue, timeStr) cookieVal := fmt.Sprintf("%s|%s|%s", encodedValue, timeStr, sig) return ...
[ "func", "SignedValue", "(", "seed", "string", ",", "key", "string", ",", "value", "string", ",", "now", "time", ".", "Time", ")", "string", "{", "encodedValue", ":=", "base64", ".", "URLEncoding", ".", "EncodeToString", "(", "[", "]", "byte", "(", "value...
// SignedValue returns a cookie that is signed and can later be checked with Validate
[ "SignedValue", "returns", "a", "cookie", "that", "is", "signed", "and", "can", "later", "be", "checked", "with", "Validate" ]
fa2771998a98a5bfdfa3c3503757668ac4f1c8ec
https://github.com/bitly/oauth2_proxy/blob/fa2771998a98a5bfdfa3c3503757668ac4f1c8ec/cookie/cookies.go#L53-L59
146,517
bitly/oauth2_proxy
cookie/cookies.go
NewCipher
func NewCipher(secret []byte) (*Cipher, error) { c, err := aes.NewCipher(secret) if err != nil { return nil, err } return &Cipher{Block: c}, err }
go
func NewCipher(secret []byte) (*Cipher, error) { c, err := aes.NewCipher(secret) if err != nil { return nil, err } return &Cipher{Block: c}, err }
[ "func", "NewCipher", "(", "secret", "[", "]", "byte", ")", "(", "*", "Cipher", ",", "error", ")", "{", "c", ",", "err", ":=", "aes", ".", "NewCipher", "(", "secret", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "...
// NewCipher returns a new aes Cipher for encrypting cookie values
[ "NewCipher", "returns", "a", "new", "aes", "Cipher", "for", "encrypting", "cookie", "values" ]
fa2771998a98a5bfdfa3c3503757668ac4f1c8ec
https://github.com/bitly/oauth2_proxy/blob/fa2771998a98a5bfdfa3c3503757668ac4f1c8ec/cookie/cookies.go#L88-L94
146,518
bitly/oauth2_proxy
cookie/cookies.go
Encrypt
func (c *Cipher) Encrypt(value string) (string, error) { ciphertext := make([]byte, aes.BlockSize+len(value)) iv := ciphertext[:aes.BlockSize] if _, err := io.ReadFull(rand.Reader, iv); err != nil { return "", fmt.Errorf("failed to create initialization vector %s", err) } stream := cipher.NewCFBEncrypter(c.Bloc...
go
func (c *Cipher) Encrypt(value string) (string, error) { ciphertext := make([]byte, aes.BlockSize+len(value)) iv := ciphertext[:aes.BlockSize] if _, err := io.ReadFull(rand.Reader, iv); err != nil { return "", fmt.Errorf("failed to create initialization vector %s", err) } stream := cipher.NewCFBEncrypter(c.Bloc...
[ "func", "(", "c", "*", "Cipher", ")", "Encrypt", "(", "value", "string", ")", "(", "string", ",", "error", ")", "{", "ciphertext", ":=", "make", "(", "[", "]", "byte", ",", "aes", ".", "BlockSize", "+", "len", "(", "value", ")", ")", "\n", "iv", ...
// Encrypt a value for use in a cookie
[ "Encrypt", "a", "value", "for", "use", "in", "a", "cookie" ]
fa2771998a98a5bfdfa3c3503757668ac4f1c8ec
https://github.com/bitly/oauth2_proxy/blob/fa2771998a98a5bfdfa3c3503757668ac4f1c8ec/cookie/cookies.go#L97-L107
146,519
bitly/oauth2_proxy
cookie/cookies.go
Decrypt
func (c *Cipher) Decrypt(s string) (string, error) { encrypted, err := base64.StdEncoding.DecodeString(s) if err != nil { return "", fmt.Errorf("failed to decrypt cookie value %s", err) } if len(encrypted) < aes.BlockSize { return "", fmt.Errorf("encrypted cookie value should be "+ "at least %d bytes, but i...
go
func (c *Cipher) Decrypt(s string) (string, error) { encrypted, err := base64.StdEncoding.DecodeString(s) if err != nil { return "", fmt.Errorf("failed to decrypt cookie value %s", err) } if len(encrypted) < aes.BlockSize { return "", fmt.Errorf("encrypted cookie value should be "+ "at least %d bytes, but i...
[ "func", "(", "c", "*", "Cipher", ")", "Decrypt", "(", "s", "string", ")", "(", "string", ",", "error", ")", "{", "encrypted", ",", "err", ":=", "base64", ".", "StdEncoding", ".", "DecodeString", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", ...
// Decrypt a value from a cookie to it's original string
[ "Decrypt", "a", "value", "from", "a", "cookie", "to", "it", "s", "original", "string" ]
fa2771998a98a5bfdfa3c3503757668ac4f1c8ec
https://github.com/bitly/oauth2_proxy/blob/fa2771998a98a5bfdfa3c3503757668ac4f1c8ec/cookie/cookies.go#L110-L128
146,520
bitly/oauth2_proxy
providers/provider_default.go
GetLoginURL
func (p *ProviderData) GetLoginURL(redirectURI, state string) string { var a url.URL a = *p.LoginURL params, _ := url.ParseQuery(a.RawQuery) params.Set("redirect_uri", redirectURI) params.Set("approval_prompt", p.ApprovalPrompt) params.Add("scope", p.Scope) params.Set("client_id", p.ClientID) params.Set("respon...
go
func (p *ProviderData) GetLoginURL(redirectURI, state string) string { var a url.URL a = *p.LoginURL params, _ := url.ParseQuery(a.RawQuery) params.Set("redirect_uri", redirectURI) params.Set("approval_prompt", p.ApprovalPrompt) params.Add("scope", p.Scope) params.Set("client_id", p.ClientID) params.Set("respon...
[ "func", "(", "p", "*", "ProviderData", ")", "GetLoginURL", "(", "redirectURI", ",", "state", "string", ")", "string", "{", "var", "a", "url", ".", "URL", "\n", "a", "=", "*", "p", ".", "LoginURL", "\n", "params", ",", "_", ":=", "url", ".", "ParseQ...
// GetLoginURL with typical oauth parameters
[ "GetLoginURL", "with", "typical", "oauth", "parameters" ]
fa2771998a98a5bfdfa3c3503757668ac4f1c8ec
https://github.com/bitly/oauth2_proxy/blob/fa2771998a98a5bfdfa3c3503757668ac4f1c8ec/providers/provider_default.go#L81-L93
146,521
bitly/oauth2_proxy
providers/provider_default.go
CookieForSession
func (p *ProviderData) CookieForSession(s *SessionState, c *cookie.Cipher) (string, error) { return s.EncodeSessionState(c) }
go
func (p *ProviderData) CookieForSession(s *SessionState, c *cookie.Cipher) (string, error) { return s.EncodeSessionState(c) }
[ "func", "(", "p", "*", "ProviderData", ")", "CookieForSession", "(", "s", "*", "SessionState", ",", "c", "*", "cookie", ".", "Cipher", ")", "(", "string", ",", "error", ")", "{", "return", "s", ".", "EncodeSessionState", "(", "c", ")", "\n", "}" ]
// CookieForSession serializes a session state for storage in a cookie
[ "CookieForSession", "serializes", "a", "session", "state", "for", "storage", "in", "a", "cookie" ]
fa2771998a98a5bfdfa3c3503757668ac4f1c8ec
https://github.com/bitly/oauth2_proxy/blob/fa2771998a98a5bfdfa3c3503757668ac4f1c8ec/providers/provider_default.go#L96-L98
146,522
bitly/oauth2_proxy
providers/provider_default.go
SessionFromCookie
func (p *ProviderData) SessionFromCookie(v string, c *cookie.Cipher) (s *SessionState, err error) { return DecodeSessionState(v, c) }
go
func (p *ProviderData) SessionFromCookie(v string, c *cookie.Cipher) (s *SessionState, err error) { return DecodeSessionState(v, c) }
[ "func", "(", "p", "*", "ProviderData", ")", "SessionFromCookie", "(", "v", "string", ",", "c", "*", "cookie", ".", "Cipher", ")", "(", "s", "*", "SessionState", ",", "err", "error", ")", "{", "return", "DecodeSessionState", "(", "v", ",", "c", ")", "...
// SessionFromCookie deserializes a session from a cookie value
[ "SessionFromCookie", "deserializes", "a", "session", "from", "a", "cookie", "value" ]
fa2771998a98a5bfdfa3c3503757668ac4f1c8ec
https://github.com/bitly/oauth2_proxy/blob/fa2771998a98a5bfdfa3c3503757668ac4f1c8ec/providers/provider_default.go#L101-L103
146,523
mattn/go-sqlite3
_example/custom_func/main.go
xor
func xor(xs ...int64) int64 { var ret int64 for _, x := range xs { ret ^= x } return ret }
go
func xor(xs ...int64) int64 { var ret int64 for _, x := range xs { ret ^= x } return ret }
[ "func", "xor", "(", "xs", "...", "int64", ")", "int64", "{", "var", "ret", "int64", "\n", "for", "_", ",", "x", ":=", "range", "xs", "{", "ret", "^=", "x", "\n", "}", "\n", "return", "ret", "\n", "}" ]
// Computes the bitwise exclusive-or of all its arguments
[ "Computes", "the", "bitwise", "exclusive", "-", "or", "of", "all", "its", "arguments" ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/_example/custom_func/main.go#L19-L25
146,524
mattn/go-sqlite3
sqlite3_trace.go
popTraceMapping
func popTraceMapping(connHandle uintptr) (TraceConfig, bool) { traceMapLock.Lock() defer traceMapLock.Unlock() entryCopy, found := traceMap[connHandle] if found { delete(traceMap, connHandle) fmt.Printf("Pop handle 0x%x: deleted trace config %v.\n", connHandle, entryCopy.config) } return entryCopy.config, fo...
go
func popTraceMapping(connHandle uintptr) (TraceConfig, bool) { traceMapLock.Lock() defer traceMapLock.Unlock() entryCopy, found := traceMap[connHandle] if found { delete(traceMap, connHandle) fmt.Printf("Pop handle 0x%x: deleted trace config %v.\n", connHandle, entryCopy.config) } return entryCopy.config, fo...
[ "func", "popTraceMapping", "(", "connHandle", "uintptr", ")", "(", "TraceConfig", ",", "bool", ")", "{", "traceMapLock", ".", "Lock", "(", ")", "\n", "defer", "traceMapLock", ".", "Unlock", "(", ")", "\n\n", "entryCopy", ",", "found", ":=", "traceMap", "["...
// 'pop' = get and delete from map before returning the value to the caller
[ "pop", "=", "get", "and", "delete", "from", "map", "before", "returning", "the", "value", "to", "the", "caller" ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3_trace.go#L229-L239
146,525
mattn/go-sqlite3
backup.go
Backup
func (c *SQLiteConn) Backup(dest string, conn *SQLiteConn, src string) (*SQLiteBackup, error) { destptr := C.CString(dest) defer C.free(unsafe.Pointer(destptr)) srcptr := C.CString(src) defer C.free(unsafe.Pointer(srcptr)) if b := C.sqlite3_backup_init(c.db, destptr, conn.db, srcptr); b != nil { bb := &SQLiteBa...
go
func (c *SQLiteConn) Backup(dest string, conn *SQLiteConn, src string) (*SQLiteBackup, error) { destptr := C.CString(dest) defer C.free(unsafe.Pointer(destptr)) srcptr := C.CString(src) defer C.free(unsafe.Pointer(srcptr)) if b := C.sqlite3_backup_init(c.db, destptr, conn.db, srcptr); b != nil { bb := &SQLiteBa...
[ "func", "(", "c", "*", "SQLiteConn", ")", "Backup", "(", "dest", "string", ",", "conn", "*", "SQLiteConn", ",", "src", "string", ")", "(", "*", "SQLiteBackup", ",", "error", ")", "{", "destptr", ":=", "C", ".", "CString", "(", "dest", ")", "\n", "d...
// Backup make backup from src to dest.
[ "Backup", "make", "backup", "from", "src", "to", "dest", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/backup.go#L28-L40
146,526
mattn/go-sqlite3
backup.go
Close
func (b *SQLiteBackup) Close() error { ret := C.sqlite3_backup_finish(b.b) // sqlite3_backup_finish() never fails, it just returns the // error code from previous operations, so clean up before // checking and returning an error b.b = nil runtime.SetFinalizer(b, nil) if ret != 0 { return Error{Code: ErrNo(re...
go
func (b *SQLiteBackup) Close() error { ret := C.sqlite3_backup_finish(b.b) // sqlite3_backup_finish() never fails, it just returns the // error code from previous operations, so clean up before // checking and returning an error b.b = nil runtime.SetFinalizer(b, nil) if ret != 0 { return Error{Code: ErrNo(re...
[ "func", "(", "b", "*", "SQLiteBackup", ")", "Close", "(", ")", "error", "{", "ret", ":=", "C", ".", "sqlite3_backup_finish", "(", "b", ".", "b", ")", "\n\n", "// sqlite3_backup_finish() never fails, it just returns the", "// error code from previous operations, so clean...
// Close close backup.
[ "Close", "close", "backup", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/backup.go#L72-L85
146,527
mattn/go-sqlite3
sqlite3_context.go
ResultBool
func (c *SQLiteContext) ResultBool(b bool) { if b { c.ResultInt(1) } else { c.ResultInt(0) } }
go
func (c *SQLiteContext) ResultBool(b bool) { if b { c.ResultInt(1) } else { c.ResultInt(0) } }
[ "func", "(", "c", "*", "SQLiteContext", ")", "ResultBool", "(", "b", "bool", ")", "{", "if", "b", "{", "c", ".", "ResultInt", "(", "1", ")", "\n", "}", "else", "{", "c", ".", "ResultInt", "(", "0", ")", "\n", "}", "\n", "}" ]
// ResultBool sets the result of an SQL function.
[ "ResultBool", "sets", "the", "result", "of", "an", "SQL", "function", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3_context.go#L41-L47
146,528
mattn/go-sqlite3
error.go
Extend
func (err ErrNo) Extend(by int) ErrNoExtended { return ErrNoExtended(int(err) | (by << 8)) }
go
func (err ErrNo) Extend(by int) ErrNoExtended { return ErrNoExtended(int(err) | (by << 8)) }
[ "func", "(", "err", "ErrNo", ")", "Extend", "(", "by", "int", ")", "ErrNoExtended", "{", "return", "ErrNoExtended", "(", "int", "(", "err", ")", "|", "(", "by", "<<", "8", ")", ")", "\n", "}" ]
// Extend return extended errno.
[ "Extend", "return", "extended", "errno", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/error.go#L65-L67
146,529
mattn/go-sqlite3
error.go
Error
func (err ErrNoExtended) Error() string { return Error{Code: ErrNo(C.int(err) & ErrNoMask), ExtendedCode: err}.Error() }
go
func (err ErrNoExtended) Error() string { return Error{Code: ErrNo(C.int(err) & ErrNoMask), ExtendedCode: err}.Error() }
[ "func", "(", "err", "ErrNoExtended", ")", "Error", "(", ")", "string", "{", "return", "Error", "{", "Code", ":", "ErrNo", "(", "C", ".", "int", "(", "err", ")", "&", "ErrNoMask", ")", ",", "ExtendedCode", ":", "err", "}", ".", "Error", "(", ")", ...
// Error return error message that is extended code.
[ "Error", "return", "error", "message", "that", "is", "extended", "code", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/error.go#L70-L72
146,530
mattn/go-sqlite3
sqlite3_opt_vtable.go
mPrintf
func mPrintf(format, arg string) *C.char { cf := C.CString(format) defer C.free(unsafe.Pointer(cf)) ca := C.CString(arg) defer C.free(unsafe.Pointer(ca)) return C._sqlite3_mprintf(cf, ca) }
go
func mPrintf(format, arg string) *C.char { cf := C.CString(format) defer C.free(unsafe.Pointer(cf)) ca := C.CString(arg) defer C.free(unsafe.Pointer(ca)) return C._sqlite3_mprintf(cf, ca) }
[ "func", "mPrintf", "(", "format", ",", "arg", "string", ")", "*", "C", ".", "char", "{", "cf", ":=", "C", ".", "CString", "(", "format", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cf", ")", ")", "\n", "ca", ":=",...
// mPrintf is a utility wrapper around sqlite3_mprintf
[ "mPrintf", "is", "a", "utility", "wrapper", "around", "sqlite3_mprintf" ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3_opt_vtable.go#L340-L346
146,531
mattn/go-sqlite3
sqlite3.go
Version
func Version() (libVersion string, libVersionNumber int, sourceID string) { libVersion = C.GoString(C.sqlite3_libversion()) libVersionNumber = int(C.sqlite3_libversion_number()) sourceID = C.GoString(C.sqlite3_sourceid()) return libVersion, libVersionNumber, sourceID }
go
func Version() (libVersion string, libVersionNumber int, sourceID string) { libVersion = C.GoString(C.sqlite3_libversion()) libVersionNumber = int(C.sqlite3_libversion_number()) sourceID = C.GoString(C.sqlite3_sourceid()) return libVersion, libVersionNumber, sourceID }
[ "func", "Version", "(", ")", "(", "libVersion", "string", ",", "libVersionNumber", "int", ",", "sourceID", "string", ")", "{", "libVersion", "=", "C", ".", "GoString", "(", "C", ".", "sqlite3_libversion", "(", ")", ")", "\n", "libVersionNumber", "=", "int"...
// Version returns SQLite library version information.
[ "Version", "returns", "SQLite", "library", "version", "information", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3.go#L234-L239
146,532
mattn/go-sqlite3
sqlite3.go
Commit
func (tx *SQLiteTx) Commit() error { _, err := tx.c.exec(context.Background(), "COMMIT", nil) if err != nil && err.(Error).Code == C.SQLITE_BUSY { // sqlite3 will leave the transaction open in this scenario. // However, database/sql considers the transaction complete once we // return from Commit() - we must cl...
go
func (tx *SQLiteTx) Commit() error { _, err := tx.c.exec(context.Background(), "COMMIT", nil) if err != nil && err.(Error).Code == C.SQLITE_BUSY { // sqlite3 will leave the transaction open in this scenario. // However, database/sql considers the transaction complete once we // return from Commit() - we must cl...
[ "func", "(", "tx", "*", "SQLiteTx", ")", "Commit", "(", ")", "error", "{", "_", ",", "err", ":=", "tx", ".", "c", ".", "exec", "(", "context", ".", "Background", "(", ")", ",", "\"", "\"", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "&&"...
// Commit transaction.
[ "Commit", "transaction", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3.go#L436-L445
146,533
mattn/go-sqlite3
sqlite3.go
Rollback
func (tx *SQLiteTx) Rollback() error { _, err := tx.c.exec(context.Background(), "ROLLBACK", nil) return err }
go
func (tx *SQLiteTx) Rollback() error { _, err := tx.c.exec(context.Background(), "ROLLBACK", nil) return err }
[ "func", "(", "tx", "*", "SQLiteTx", ")", "Rollback", "(", ")", "error", "{", "_", ",", "err", ":=", "tx", ".", "c", ".", "exec", "(", "context", ".", "Background", "(", ")", ",", "\"", "\"", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
// Rollback transaction.
[ "Rollback", "transaction", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3.go#L448-L451
146,534
mattn/go-sqlite3
sqlite3.go
AutoCommit
func (c *SQLiteConn) AutoCommit() bool { c.mu.Lock() defer c.mu.Unlock() return int(C.sqlite3_get_autocommit(c.db)) != 0 }
go
func (c *SQLiteConn) AutoCommit() bool { c.mu.Lock() defer c.mu.Unlock() return int(C.sqlite3_get_autocommit(c.db)) != 0 }
[ "func", "(", "c", "*", "SQLiteConn", ")", "AutoCommit", "(", ")", "bool", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "int", "(", "C", ".", "sqlite3_get_autocommit", "(", "c"...
// AutoCommit return which currently auto commit or not.
[ "AutoCommit", "return", "which", "currently", "auto", "commit", "or", "not", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3.go#L742-L746
146,535
mattn/go-sqlite3
sqlite3.go
Query
func (c *SQLiteConn) Query(query string, args []driver.Value) (driver.Rows, error) { list := make([]namedValue, len(args)) for i, v := range args { list[i] = namedValue{ Ordinal: i + 1, Value: v, } } return c.query(context.Background(), query, list) }
go
func (c *SQLiteConn) Query(query string, args []driver.Value) (driver.Rows, error) { list := make([]namedValue, len(args)) for i, v := range args { list[i] = namedValue{ Ordinal: i + 1, Value: v, } } return c.query(context.Background(), query, list) }
[ "func", "(", "c", "*", "SQLiteConn", ")", "Query", "(", "query", "string", ",", "args", "[", "]", "driver", ".", "Value", ")", "(", "driver", ".", "Rows", ",", "error", ")", "{", "list", ":=", "make", "(", "[", "]", "namedValue", ",", "len", "(",...
// Query implements Queryer.
[ "Query", "implements", "Queryer", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3.go#L817-L826
146,536
mattn/go-sqlite3
sqlite3.go
Begin
func (c *SQLiteConn) Begin() (driver.Tx, error) { return c.begin(context.Background()) }
go
func (c *SQLiteConn) Begin() (driver.Tx, error) { return c.begin(context.Background()) }
[ "func", "(", "c", "*", "SQLiteConn", ")", "Begin", "(", ")", "(", "driver", ".", "Tx", ",", "error", ")", "{", "return", "c", ".", "begin", "(", "context", ".", "Background", "(", ")", ")", "\n", "}" ]
// Begin transaction.
[ "Begin", "transaction", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3.go#L861-L863
146,537
mattn/go-sqlite3
sqlite3.go
Close
func (c *SQLiteConn) Close() error { rv := C.sqlite3_close_v2(c.db) if rv != C.SQLITE_OK { return c.lastError() } deleteHandles(c) c.mu.Lock() c.db = nil c.mu.Unlock() runtime.SetFinalizer(c, nil) return nil }
go
func (c *SQLiteConn) Close() error { rv := C.sqlite3_close_v2(c.db) if rv != C.SQLITE_OK { return c.lastError() } deleteHandles(c) c.mu.Lock() c.db = nil c.mu.Unlock() runtime.SetFinalizer(c, nil) return nil }
[ "func", "(", "c", "*", "SQLiteConn", ")", "Close", "(", ")", "error", "{", "rv", ":=", "C", ".", "sqlite3_close_v2", "(", "c", ".", "db", ")", "\n", "if", "rv", "!=", "C", ".", "SQLITE_OK", "{", "return", "c", ".", "lastError", "(", ")", "\n", ...
// Close the connection.
[ "Close", "the", "connection", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3.go#L1650-L1661
146,538
mattn/go-sqlite3
sqlite3.go
Prepare
func (c *SQLiteConn) Prepare(query string) (driver.Stmt, error) { return c.prepare(context.Background(), query) }
go
func (c *SQLiteConn) Prepare(query string) (driver.Stmt, error) { return c.prepare(context.Background(), query) }
[ "func", "(", "c", "*", "SQLiteConn", ")", "Prepare", "(", "query", "string", ")", "(", "driver", ".", "Stmt", ",", "error", ")", "{", "return", "c", ".", "prepare", "(", "context", ".", "Background", "(", ")", ",", "query", ")", "\n", "}" ]
// Prepare the query string. Return a new statement.
[ "Prepare", "the", "query", "string", ".", "Return", "a", "new", "statement", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3.go#L1673-L1675
146,539
mattn/go-sqlite3
sqlite3.go
Close
func (s *SQLiteStmt) Close() error { s.mu.Lock() defer s.mu.Unlock() if s.closed { return nil } s.closed = true if !s.c.dbConnOpen() { return errors.New("sqlite statement with already closed database connection") } rv := C.sqlite3_finalize(s.s) s.s = nil if rv != C.SQLITE_OK { return s.c.lastError() } ...
go
func (s *SQLiteStmt) Close() error { s.mu.Lock() defer s.mu.Unlock() if s.closed { return nil } s.closed = true if !s.c.dbConnOpen() { return errors.New("sqlite statement with already closed database connection") } rv := C.sqlite3_finalize(s.s) s.s = nil if rv != C.SQLITE_OK { return s.c.lastError() } ...
[ "func", "(", "s", "*", "SQLiteStmt", ")", "Close", "(", ")", "error", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "s", ".", "closed", "{", "return", "nil", "\n", "}", "\n", ...
// Close the statement.
[ "Close", "the", "statement", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3.go#L1737-L1754
146,540
mattn/go-sqlite3
sqlite3.go
Query
func (s *SQLiteStmt) Query(args []driver.Value) (driver.Rows, error) { list := make([]namedValue, len(args)) for i, v := range args { list[i] = namedValue{ Ordinal: i + 1, Value: v, } } return s.query(context.Background(), list) }
go
func (s *SQLiteStmt) Query(args []driver.Value) (driver.Rows, error) { list := make([]namedValue, len(args)) for i, v := range args { list[i] = namedValue{ Ordinal: i + 1, Value: v, } } return s.query(context.Background(), list) }
[ "func", "(", "s", "*", "SQLiteStmt", ")", "Query", "(", "args", "[", "]", "driver", ".", "Value", ")", "(", "driver", ".", "Rows", ",", "error", ")", "{", "list", ":=", "make", "(", "[", "]", "namedValue", ",", "len", "(", "args", ")", ")", "\n...
// Query the statement with arguments. Return records.
[ "Query", "the", "statement", "with", "arguments", ".", "Return", "records", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3.go#L1826-L1835
146,541
mattn/go-sqlite3
sqlite3.go
Exec
func (s *SQLiteStmt) Exec(args []driver.Value) (driver.Result, error) { list := make([]namedValue, len(args)) for i, v := range args { list[i] = namedValue{ Ordinal: i + 1, Value: v, } } return s.exec(context.Background(), list) }
go
func (s *SQLiteStmt) Exec(args []driver.Value) (driver.Result, error) { list := make([]namedValue, len(args)) for i, v := range args { list[i] = namedValue{ Ordinal: i + 1, Value: v, } } return s.exec(context.Background(), list) }
[ "func", "(", "s", "*", "SQLiteStmt", ")", "Exec", "(", "args", "[", "]", "driver", ".", "Value", ")", "(", "driver", ".", "Result", ",", "error", ")", "{", "list", ":=", "make", "(", "[", "]", "namedValue", ",", "len", "(", "args", ")", ")", "\...
// Exec execute the statement with arguments. Return result object.
[ "Exec", "execute", "the", "statement", "with", "arguments", ".", "Return", "result", "object", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3.go#L1881-L1890
146,542
mattn/go-sqlite3
sqlite3.go
Close
func (rc *SQLiteRows) Close() error { rc.s.mu.Lock() if rc.s.closed || rc.closed { rc.s.mu.Unlock() return nil } rc.closed = true if rc.done != nil { close(rc.done) } if rc.cls { rc.s.mu.Unlock() return rc.s.Close() } rv := C.sqlite3_reset(rc.s.s) if rv != C.SQLITE_OK { rc.s.mu.Unlock() return r...
go
func (rc *SQLiteRows) Close() error { rc.s.mu.Lock() if rc.s.closed || rc.closed { rc.s.mu.Unlock() return nil } rc.closed = true if rc.done != nil { close(rc.done) } if rc.cls { rc.s.mu.Unlock() return rc.s.Close() } rv := C.sqlite3_reset(rc.s.s) if rv != C.SQLITE_OK { rc.s.mu.Unlock() return r...
[ "func", "(", "rc", "*", "SQLiteRows", ")", "Close", "(", ")", "error", "{", "rc", ".", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "if", "rc", ".", "s", ".", "closed", "||", "rc", ".", "closed", "{", "rc", ".", "s", ".", "mu", ".", "Unlock...
// Close the rows.
[ "Close", "the", "rows", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3.go#L1928-L1949
146,543
mattn/go-sqlite3
sqlite3.go
Columns
func (rc *SQLiteRows) Columns() []string { rc.s.mu.Lock() defer rc.s.mu.Unlock() if rc.s.s != nil && rc.nc != len(rc.cols) { rc.cols = make([]string, rc.nc) for i := 0; i < rc.nc; i++ { rc.cols[i] = C.GoString(C.sqlite3_column_name(rc.s.s, C.int(i))) } } return rc.cols }
go
func (rc *SQLiteRows) Columns() []string { rc.s.mu.Lock() defer rc.s.mu.Unlock() if rc.s.s != nil && rc.nc != len(rc.cols) { rc.cols = make([]string, rc.nc) for i := 0; i < rc.nc; i++ { rc.cols[i] = C.GoString(C.sqlite3_column_name(rc.s.s, C.int(i))) } } return rc.cols }
[ "func", "(", "rc", "*", "SQLiteRows", ")", "Columns", "(", ")", "[", "]", "string", "{", "rc", ".", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "rc", ".", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "rc", ".", "s", ".", ...
// Columns return column names.
[ "Columns", "return", "column", "names", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3.go#L1952-L1962
146,544
mattn/go-sqlite3
sqlite3.go
DeclTypes
func (rc *SQLiteRows) DeclTypes() []string { rc.s.mu.Lock() defer rc.s.mu.Unlock() return rc.declTypes() }
go
func (rc *SQLiteRows) DeclTypes() []string { rc.s.mu.Lock() defer rc.s.mu.Unlock() return rc.declTypes() }
[ "func", "(", "rc", "*", "SQLiteRows", ")", "DeclTypes", "(", ")", "[", "]", "string", "{", "rc", ".", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "rc", ".", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "rc", ".", "declTy...
// DeclTypes return column types.
[ "DeclTypes", "return", "column", "types", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3.go#L1975-L1979
146,545
mattn/go-sqlite3
sqlite3_func_crypt.go
CryptEncoderSSHA1
func CryptEncoderSSHA1(salt string) func(pass []byte, hash interface{}) []byte { return func(pass []byte, hash interface{}) []byte { s := []byte(salt) p := append(pass, s...) h := sha1.Sum(p) return h[:] } }
go
func CryptEncoderSSHA1(salt string) func(pass []byte, hash interface{}) []byte { return func(pass []byte, hash interface{}) []byte { s := []byte(salt) p := append(pass, s...) h := sha1.Sum(p) return h[:] } }
[ "func", "CryptEncoderSSHA1", "(", "salt", "string", ")", "func", "(", "pass", "[", "]", "byte", ",", "hash", "interface", "{", "}", ")", "[", "]", "byte", "{", "return", "func", "(", "pass", "[", "]", "byte", ",", "hash", "interface", "{", "}", ")"...
// CryptEncoderSSHA1 encodes a password with SHA1 with the // configured salt.
[ "CryptEncoderSSHA1", "encodes", "a", "password", "with", "SHA1", "with", "the", "configured", "salt", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3_func_crypt.go#L60-L67
146,546
mattn/go-sqlite3
sqlite3_func_crypt.go
CryptEncoderSHA256
func CryptEncoderSHA256(pass []byte, hash interface{}) []byte { h := sha256.Sum256(pass) return h[:] }
go
func CryptEncoderSHA256(pass []byte, hash interface{}) []byte { h := sha256.Sum256(pass) return h[:] }
[ "func", "CryptEncoderSHA256", "(", "pass", "[", "]", "byte", ",", "hash", "interface", "{", "}", ")", "[", "]", "byte", "{", "h", ":=", "sha256", ".", "Sum256", "(", "pass", ")", "\n", "return", "h", "[", ":", "]", "\n", "}" ]
// CryptEncoderSHA256 encodes a password with SHA256
[ "CryptEncoderSHA256", "encodes", "a", "password", "with", "SHA256" ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3_func_crypt.go#L70-L73
146,547
mattn/go-sqlite3
sqlite3_func_crypt.go
CryptEncoderSSHA256
func CryptEncoderSSHA256(salt string) func(pass []byte, hash interface{}) []byte { return func(pass []byte, hash interface{}) []byte { s := []byte(salt) p := append(pass, s...) h := sha256.Sum256(p) return h[:] } }
go
func CryptEncoderSSHA256(salt string) func(pass []byte, hash interface{}) []byte { return func(pass []byte, hash interface{}) []byte { s := []byte(salt) p := append(pass, s...) h := sha256.Sum256(p) return h[:] } }
[ "func", "CryptEncoderSSHA256", "(", "salt", "string", ")", "func", "(", "pass", "[", "]", "byte", ",", "hash", "interface", "{", "}", ")", "[", "]", "byte", "{", "return", "func", "(", "pass", "[", "]", "byte", ",", "hash", "interface", "{", "}", "...
// CryptEncoderSSHA256 encodes a password with SHA256 // with the configured salt
[ "CryptEncoderSSHA256", "encodes", "a", "password", "with", "SHA256", "with", "the", "configured", "salt" ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3_func_crypt.go#L77-L84
146,548
mattn/go-sqlite3
sqlite3_func_crypt.go
CryptEncoderSHA384
func CryptEncoderSHA384(pass []byte, hash interface{}) []byte { h := sha512.Sum384(pass) return h[:] }
go
func CryptEncoderSHA384(pass []byte, hash interface{}) []byte { h := sha512.Sum384(pass) return h[:] }
[ "func", "CryptEncoderSHA384", "(", "pass", "[", "]", "byte", ",", "hash", "interface", "{", "}", ")", "[", "]", "byte", "{", "h", ":=", "sha512", ".", "Sum384", "(", "pass", ")", "\n", "return", "h", "[", ":", "]", "\n", "}" ]
// CryptEncoderSHA384 encodes a password with SHA384
[ "CryptEncoderSHA384", "encodes", "a", "password", "with", "SHA384" ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3_func_crypt.go#L87-L90
146,549
mattn/go-sqlite3
sqlite3_func_crypt.go
CryptEncoderSSHA384
func CryptEncoderSSHA384(salt string) func(pass []byte, hash interface{}) []byte { return func(pass []byte, hash interface{}) []byte { s := []byte(salt) p := append(pass, s...) h := sha512.Sum384(p) return h[:] } }
go
func CryptEncoderSSHA384(salt string) func(pass []byte, hash interface{}) []byte { return func(pass []byte, hash interface{}) []byte { s := []byte(salt) p := append(pass, s...) h := sha512.Sum384(p) return h[:] } }
[ "func", "CryptEncoderSSHA384", "(", "salt", "string", ")", "func", "(", "pass", "[", "]", "byte", ",", "hash", "interface", "{", "}", ")", "[", "]", "byte", "{", "return", "func", "(", "pass", "[", "]", "byte", ",", "hash", "interface", "{", "}", "...
// CryptEncoderSSHA384 encodes a password with SHA384 // with the configured salt
[ "CryptEncoderSSHA384", "encodes", "a", "password", "with", "SHA384", "with", "the", "configured", "salt" ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3_func_crypt.go#L94-L101
146,550
mattn/go-sqlite3
sqlite3_func_crypt.go
CryptEncoderSHA512
func CryptEncoderSHA512(pass []byte, hash interface{}) []byte { h := sha512.Sum512(pass) return h[:] }
go
func CryptEncoderSHA512(pass []byte, hash interface{}) []byte { h := sha512.Sum512(pass) return h[:] }
[ "func", "CryptEncoderSHA512", "(", "pass", "[", "]", "byte", ",", "hash", "interface", "{", "}", ")", "[", "]", "byte", "{", "h", ":=", "sha512", ".", "Sum512", "(", "pass", ")", "\n", "return", "h", "[", ":", "]", "\n", "}" ]
// CryptEncoderSHA512 encodes a password with SHA512
[ "CryptEncoderSHA512", "encodes", "a", "password", "with", "SHA512" ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3_func_crypt.go#L104-L107
146,551
mattn/go-sqlite3
sqlite3_func_crypt.go
CryptEncoderSSHA512
func CryptEncoderSSHA512(salt string) func(pass []byte, hash interface{}) []byte { return func(pass []byte, hash interface{}) []byte { s := []byte(salt) p := append(pass, s...) h := sha512.Sum512(p) return h[:] } }
go
func CryptEncoderSSHA512(salt string) func(pass []byte, hash interface{}) []byte { return func(pass []byte, hash interface{}) []byte { s := []byte(salt) p := append(pass, s...) h := sha512.Sum512(p) return h[:] } }
[ "func", "CryptEncoderSSHA512", "(", "salt", "string", ")", "func", "(", "pass", "[", "]", "byte", ",", "hash", "interface", "{", "}", ")", "[", "]", "byte", "{", "return", "func", "(", "pass", "[", "]", "byte", ",", "hash", "interface", "{", "}", "...
// CryptEncoderSSHA512 encodes a password with SHA512 // with the configured salt
[ "CryptEncoderSSHA512", "encodes", "a", "password", "with", "SHA512", "with", "the", "configured", "salt" ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3_func_crypt.go#L111-L118
146,552
mattn/go-sqlite3
sqlite3_go18.go
Ping
func (c *SQLiteConn) Ping(ctx context.Context) error { if c.db == nil { return errors.New("Connection was closed") } return nil }
go
func (c *SQLiteConn) Ping(ctx context.Context) error { if c.db == nil { return errors.New("Connection was closed") } return nil }
[ "func", "(", "c", "*", "SQLiteConn", ")", "Ping", "(", "ctx", "context", ".", "Context", ")", "error", "{", "if", "c", ".", "db", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}...
// Ping implement Pinger.
[ "Ping", "implement", "Pinger", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3_go18.go#L19-L24
146,553
mattn/go-sqlite3
sqlite3_go18.go
PrepareContext
func (c *SQLiteConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) { return c.prepare(ctx, query) }
go
func (c *SQLiteConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) { return c.prepare(ctx, query) }
[ "func", "(", "c", "*", "SQLiteConn", ")", "PrepareContext", "(", "ctx", "context", ".", "Context", ",", "query", "string", ")", "(", "driver", ".", "Stmt", ",", "error", ")", "{", "return", "c", ".", "prepare", "(", "ctx", ",", "query", ")", "\n", ...
// PrepareContext implement ConnPrepareContext.
[ "PrepareContext", "implement", "ConnPrepareContext", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3_go18.go#L45-L47
146,554
mattn/go-sqlite3
sqlite3_go18.go
BeginTx
func (c *SQLiteConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) { return c.begin(ctx) }
go
func (c *SQLiteConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) { return c.begin(ctx) }
[ "func", "(", "c", "*", "SQLiteConn", ")", "BeginTx", "(", "ctx", "context", ".", "Context", ",", "opts", "driver", ".", "TxOptions", ")", "(", "driver", ".", "Tx", ",", "error", ")", "{", "return", "c", ".", "begin", "(", "ctx", ")", "\n", "}" ]
// BeginTx implement ConnBeginTx.
[ "BeginTx", "implement", "ConnBeginTx", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3_go18.go#L50-L52
146,555
mattn/go-sqlite3
sqlite3_load_extension.go
LoadExtension
func (c *SQLiteConn) LoadExtension(lib string, entry string) error { rv := C.sqlite3_enable_load_extension(c.db, 1) if rv != C.SQLITE_OK { return errors.New(C.GoString(C.sqlite3_errmsg(c.db))) } clib := C.CString(lib) defer C.free(unsafe.Pointer(clib)) centry := C.CString(entry) defer C.free(unsafe.Pointer(ce...
go
func (c *SQLiteConn) LoadExtension(lib string, entry string) error { rv := C.sqlite3_enable_load_extension(c.db, 1) if rv != C.SQLITE_OK { return errors.New(C.GoString(C.sqlite3_errmsg(c.db))) } clib := C.CString(lib) defer C.free(unsafe.Pointer(clib)) centry := C.CString(entry) defer C.free(unsafe.Pointer(ce...
[ "func", "(", "c", "*", "SQLiteConn", ")", "LoadExtension", "(", "lib", "string", ",", "entry", "string", ")", "error", "{", "rv", ":=", "C", ".", "sqlite3_enable_load_extension", "(", "c", ".", "db", ",", "1", ")", "\n", "if", "rv", "!=", "C", ".", ...
// LoadExtension load the sqlite3 extension.
[ "LoadExtension", "load", "the", "sqlite3", "extension", "." ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3_load_extension.go#L48-L70
146,556
mattn/go-sqlite3
sqlite3_opt_userauth.go
AuthEnabled
func (c *SQLiteConn) AuthEnabled() (exists bool) { rv := c.authEnabled() if rv == 1 { exists = true } return }
go
func (c *SQLiteConn) AuthEnabled() (exists bool) { rv := c.authEnabled() if rv == 1 { exists = true } return }
[ "func", "(", "c", "*", "SQLiteConn", ")", "AuthEnabled", "(", ")", "(", "exists", "bool", ")", "{", "rv", ":=", "c", ".", "authEnabled", "(", ")", "\n", "if", "rv", "==", "1", "{", "exists", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
// AuthEnabled checks if the database is protected by user authentication
[ "AuthEnabled", "checks", "if", "the", "database", "is", "protected", "by", "user", "authentication" ]
5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3
https://github.com/mattn/go-sqlite3/blob/5994cc52dfa89a4ee21ac891b06fbc1ea02c52d3/sqlite3_opt_userauth.go#L268-L275
146,557
gliderlabs/registrator
consul/consul.go
Ping
func (r *ConsulAdapter) Ping() error { status := r.client.Status() leader, err := status.Leader() if err != nil { return err } log.Println("consul: current leader ", leader) return nil }
go
func (r *ConsulAdapter) Ping() error { status := r.client.Status() leader, err := status.Leader() if err != nil { return err } log.Println("consul: current leader ", leader) return nil }
[ "func", "(", "r", "*", "ConsulAdapter", ")", "Ping", "(", ")", "error", "{", "status", ":=", "r", ".", "client", ".", "Status", "(", ")", "\n", "leader", ",", "err", ":=", "status", ".", "Leader", "(", ")", "\n", "if", "err", "!=", "nil", "{", ...
// Ping will try to connect to consul by attempting to retrieve the current leader.
[ "Ping", "will", "try", "to", "connect", "to", "consul", "by", "attempting", "to", "retrieve", "the", "current", "leader", "." ]
da90d170da9dd7e1a8d9a13429d44686dc3d118f
https://github.com/gliderlabs/registrator/blob/da90d170da9dd7e1a8d9a13429d44686dc3d118f/consul/consul.go#L69-L78
146,558
orcaman/concurrent-map
concurrent_map.go
New
func New() ConcurrentMap { m := make(ConcurrentMap, SHARD_COUNT) for i := 0; i < SHARD_COUNT; i++ { m[i] = &ConcurrentMapShared{items: make(map[string]interface{})} } return m }
go
func New() ConcurrentMap { m := make(ConcurrentMap, SHARD_COUNT) for i := 0; i < SHARD_COUNT; i++ { m[i] = &ConcurrentMapShared{items: make(map[string]interface{})} } return m }
[ "func", "New", "(", ")", "ConcurrentMap", "{", "m", ":=", "make", "(", "ConcurrentMap", ",", "SHARD_COUNT", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "SHARD_COUNT", ";", "i", "++", "{", "m", "[", "i", "]", "=", "&", "ConcurrentMapShared", "{...
// Creates a new concurrent map.
[ "Creates", "a", "new", "concurrent", "map", "." ]
2693aad1ed7517c2bb5b3a42cb8fde88b941d89d
https://github.com/orcaman/concurrent-map/blob/2693aad1ed7517c2bb5b3a42cb8fde88b941d89d/concurrent_map.go#L21-L27
146,559
orcaman/concurrent-map
concurrent_map.go
GetShard
func (m ConcurrentMap) GetShard(key string) *ConcurrentMapShared { return m[uint(fnv32(key))%uint(SHARD_COUNT)] }
go
func (m ConcurrentMap) GetShard(key string) *ConcurrentMapShared { return m[uint(fnv32(key))%uint(SHARD_COUNT)] }
[ "func", "(", "m", "ConcurrentMap", ")", "GetShard", "(", "key", "string", ")", "*", "ConcurrentMapShared", "{", "return", "m", "[", "uint", "(", "fnv32", "(", "key", ")", ")", "%", "uint", "(", "SHARD_COUNT", ")", "]", "\n", "}" ]
// GetShard returns shard under given key
[ "GetShard", "returns", "shard", "under", "given", "key" ]
2693aad1ed7517c2bb5b3a42cb8fde88b941d89d
https://github.com/orcaman/concurrent-map/blob/2693aad1ed7517c2bb5b3a42cb8fde88b941d89d/concurrent_map.go#L30-L32
146,560
orcaman/concurrent-map
concurrent_map.go
Set
func (m ConcurrentMap) Set(key string, value interface{}) { // Get map shard. shard := m.GetShard(key) shard.Lock() shard.items[key] = value shard.Unlock() }
go
func (m ConcurrentMap) Set(key string, value interface{}) { // Get map shard. shard := m.GetShard(key) shard.Lock() shard.items[key] = value shard.Unlock() }
[ "func", "(", "m", "ConcurrentMap", ")", "Set", "(", "key", "string", ",", "value", "interface", "{", "}", ")", "{", "// Get map shard.", "shard", ":=", "m", ".", "GetShard", "(", "key", ")", "\n", "shard", ".", "Lock", "(", ")", "\n", "shard", ".", ...
// Sets the given value under the specified key.
[ "Sets", "the", "given", "value", "under", "the", "specified", "key", "." ]
2693aad1ed7517c2bb5b3a42cb8fde88b941d89d
https://github.com/orcaman/concurrent-map/blob/2693aad1ed7517c2bb5b3a42cb8fde88b941d89d/concurrent_map.go#L44-L50
146,561
orcaman/concurrent-map
concurrent_map.go
Upsert
func (m ConcurrentMap) Upsert(key string, value interface{}, cb UpsertCb) (res interface{}) { shard := m.GetShard(key) shard.Lock() v, ok := shard.items[key] res = cb(ok, v, value) shard.items[key] = res shard.Unlock() return res }
go
func (m ConcurrentMap) Upsert(key string, value interface{}, cb UpsertCb) (res interface{}) { shard := m.GetShard(key) shard.Lock() v, ok := shard.items[key] res = cb(ok, v, value) shard.items[key] = res shard.Unlock() return res }
[ "func", "(", "m", "ConcurrentMap", ")", "Upsert", "(", "key", "string", ",", "value", "interface", "{", "}", ",", "cb", "UpsertCb", ")", "(", "res", "interface", "{", "}", ")", "{", "shard", ":=", "m", ".", "GetShard", "(", "key", ")", "\n", "shard...
// Insert or Update - updates existing element or inserts a new one using UpsertCb
[ "Insert", "or", "Update", "-", "updates", "existing", "element", "or", "inserts", "a", "new", "one", "using", "UpsertCb" ]
2693aad1ed7517c2bb5b3a42cb8fde88b941d89d
https://github.com/orcaman/concurrent-map/blob/2693aad1ed7517c2bb5b3a42cb8fde88b941d89d/concurrent_map.go#L59-L67
146,562
orcaman/concurrent-map
concurrent_map.go
SetIfAbsent
func (m ConcurrentMap) SetIfAbsent(key string, value interface{}) bool { // Get map shard. shard := m.GetShard(key) shard.Lock() _, ok := shard.items[key] if !ok { shard.items[key] = value } shard.Unlock() return !ok }
go
func (m ConcurrentMap) SetIfAbsent(key string, value interface{}) bool { // Get map shard. shard := m.GetShard(key) shard.Lock() _, ok := shard.items[key] if !ok { shard.items[key] = value } shard.Unlock() return !ok }
[ "func", "(", "m", "ConcurrentMap", ")", "SetIfAbsent", "(", "key", "string", ",", "value", "interface", "{", "}", ")", "bool", "{", "// Get map shard.", "shard", ":=", "m", ".", "GetShard", "(", "key", ")", "\n", "shard", ".", "Lock", "(", ")", "\n", ...
// Sets the given value under the specified key if no value was associated with it.
[ "Sets", "the", "given", "value", "under", "the", "specified", "key", "if", "no", "value", "was", "associated", "with", "it", "." ]
2693aad1ed7517c2bb5b3a42cb8fde88b941d89d
https://github.com/orcaman/concurrent-map/blob/2693aad1ed7517c2bb5b3a42cb8fde88b941d89d/concurrent_map.go#L70-L80
146,563
orcaman/concurrent-map
concurrent_map.go
Get
func (m ConcurrentMap) Get(key string) (interface{}, bool) { // Get shard shard := m.GetShard(key) shard.RLock() // Get item from shard. val, ok := shard.items[key] shard.RUnlock() return val, ok }
go
func (m ConcurrentMap) Get(key string) (interface{}, bool) { // Get shard shard := m.GetShard(key) shard.RLock() // Get item from shard. val, ok := shard.items[key] shard.RUnlock() return val, ok }
[ "func", "(", "m", "ConcurrentMap", ")", "Get", "(", "key", "string", ")", "(", "interface", "{", "}", ",", "bool", ")", "{", "// Get shard", "shard", ":=", "m", ".", "GetShard", "(", "key", ")", "\n", "shard", ".", "RLock", "(", ")", "\n", "// Get ...
// Get retrieves an element from map under given key.
[ "Get", "retrieves", "an", "element", "from", "map", "under", "given", "key", "." ]
2693aad1ed7517c2bb5b3a42cb8fde88b941d89d
https://github.com/orcaman/concurrent-map/blob/2693aad1ed7517c2bb5b3a42cb8fde88b941d89d/concurrent_map.go#L83-L91
146,564
orcaman/concurrent-map
concurrent_map.go
Count
func (m ConcurrentMap) Count() int { count := 0 for i := 0; i < SHARD_COUNT; i++ { shard := m[i] shard.RLock() count += len(shard.items) shard.RUnlock() } return count }
go
func (m ConcurrentMap) Count() int { count := 0 for i := 0; i < SHARD_COUNT; i++ { shard := m[i] shard.RLock() count += len(shard.items) shard.RUnlock() } return count }
[ "func", "(", "m", "ConcurrentMap", ")", "Count", "(", ")", "int", "{", "count", ":=", "0", "\n", "for", "i", ":=", "0", ";", "i", "<", "SHARD_COUNT", ";", "i", "++", "{", "shard", ":=", "m", "[", "i", "]", "\n", "shard", ".", "RLock", "(", ")...
// Count returns the number of elements within the map.
[ "Count", "returns", "the", "number", "of", "elements", "within", "the", "map", "." ]
2693aad1ed7517c2bb5b3a42cb8fde88b941d89d
https://github.com/orcaman/concurrent-map/blob/2693aad1ed7517c2bb5b3a42cb8fde88b941d89d/concurrent_map.go#L94-L103
146,565
orcaman/concurrent-map
concurrent_map.go
Has
func (m ConcurrentMap) Has(key string) bool { // Get shard shard := m.GetShard(key) shard.RLock() // See if element is within shard. _, ok := shard.items[key] shard.RUnlock() return ok }
go
func (m ConcurrentMap) Has(key string) bool { // Get shard shard := m.GetShard(key) shard.RLock() // See if element is within shard. _, ok := shard.items[key] shard.RUnlock() return ok }
[ "func", "(", "m", "ConcurrentMap", ")", "Has", "(", "key", "string", ")", "bool", "{", "// Get shard", "shard", ":=", "m", ".", "GetShard", "(", "key", ")", "\n", "shard", ".", "RLock", "(", ")", "\n", "// See if element is within shard.", "_", ",", "ok"...
// Looks up an item under specified key
[ "Looks", "up", "an", "item", "under", "specified", "key" ]
2693aad1ed7517c2bb5b3a42cb8fde88b941d89d
https://github.com/orcaman/concurrent-map/blob/2693aad1ed7517c2bb5b3a42cb8fde88b941d89d/concurrent_map.go#L106-L114
146,566
orcaman/concurrent-map
concurrent_map.go
Remove
func (m ConcurrentMap) Remove(key string) { // Try to get shard. shard := m.GetShard(key) shard.Lock() delete(shard.items, key) shard.Unlock() }
go
func (m ConcurrentMap) Remove(key string) { // Try to get shard. shard := m.GetShard(key) shard.Lock() delete(shard.items, key) shard.Unlock() }
[ "func", "(", "m", "ConcurrentMap", ")", "Remove", "(", "key", "string", ")", "{", "// Try to get shard.", "shard", ":=", "m", ".", "GetShard", "(", "key", ")", "\n", "shard", ".", "Lock", "(", ")", "\n", "delete", "(", "shard", ".", "items", ",", "ke...
// Remove removes an element from the map.
[ "Remove", "removes", "an", "element", "from", "the", "map", "." ]
2693aad1ed7517c2bb5b3a42cb8fde88b941d89d
https://github.com/orcaman/concurrent-map/blob/2693aad1ed7517c2bb5b3a42cb8fde88b941d89d/concurrent_map.go#L117-L123
146,567
orcaman/concurrent-map
concurrent_map.go
Pop
func (m ConcurrentMap) Pop(key string) (v interface{}, exists bool) { // Try to get shard. shard := m.GetShard(key) shard.Lock() v, exists = shard.items[key] delete(shard.items, key) shard.Unlock() return v, exists }
go
func (m ConcurrentMap) Pop(key string) (v interface{}, exists bool) { // Try to get shard. shard := m.GetShard(key) shard.Lock() v, exists = shard.items[key] delete(shard.items, key) shard.Unlock() return v, exists }
[ "func", "(", "m", "ConcurrentMap", ")", "Pop", "(", "key", "string", ")", "(", "v", "interface", "{", "}", ",", "exists", "bool", ")", "{", "// Try to get shard.", "shard", ":=", "m", ".", "GetShard", "(", "key", ")", "\n", "shard", ".", "Lock", "(",...
// Pop removes an element from the map and returns it
[ "Pop", "removes", "an", "element", "from", "the", "map", "and", "returns", "it" ]
2693aad1ed7517c2bb5b3a42cb8fde88b941d89d
https://github.com/orcaman/concurrent-map/blob/2693aad1ed7517c2bb5b3a42cb8fde88b941d89d/concurrent_map.go#L146-L154
146,568
orcaman/concurrent-map
concurrent_map.go
IterBuffered
func (m ConcurrentMap) IterBuffered() <-chan Tuple { chans := snapshot(m) total := 0 for _, c := range chans { total += cap(c) } ch := make(chan Tuple, total) go fanIn(chans, ch) return ch }
go
func (m ConcurrentMap) IterBuffered() <-chan Tuple { chans := snapshot(m) total := 0 for _, c := range chans { total += cap(c) } ch := make(chan Tuple, total) go fanIn(chans, ch) return ch }
[ "func", "(", "m", "ConcurrentMap", ")", "IterBuffered", "(", ")", "<-", "chan", "Tuple", "{", "chans", ":=", "snapshot", "(", "m", ")", "\n", "total", ":=", "0", "\n", "for", "_", ",", "c", ":=", "range", "chans", "{", "total", "+=", "cap", "(", ...
// IterBuffered returns a buffered iterator which could be used in a for range loop.
[ "IterBuffered", "returns", "a", "buffered", "iterator", "which", "could", "be", "used", "in", "a", "for", "range", "loop", "." ]
2693aad1ed7517c2bb5b3a42cb8fde88b941d89d
https://github.com/orcaman/concurrent-map/blob/2693aad1ed7517c2bb5b3a42cb8fde88b941d89d/concurrent_map.go#L178-L187
146,569
orcaman/concurrent-map
concurrent_map.go
snapshot
func snapshot(m ConcurrentMap) (chans []chan Tuple) { chans = make([]chan Tuple, SHARD_COUNT) wg := sync.WaitGroup{} wg.Add(SHARD_COUNT) // Foreach shard. for index, shard := range m { go func(index int, shard *ConcurrentMapShared) { // Foreach key, value pair. shard.RLock() chans[index] = make(chan Tup...
go
func snapshot(m ConcurrentMap) (chans []chan Tuple) { chans = make([]chan Tuple, SHARD_COUNT) wg := sync.WaitGroup{} wg.Add(SHARD_COUNT) // Foreach shard. for index, shard := range m { go func(index int, shard *ConcurrentMapShared) { // Foreach key, value pair. shard.RLock() chans[index] = make(chan Tup...
[ "func", "snapshot", "(", "m", "ConcurrentMap", ")", "(", "chans", "[", "]", "chan", "Tuple", ")", "{", "chans", "=", "make", "(", "[", "]", "chan", "Tuple", ",", "SHARD_COUNT", ")", "\n", "wg", ":=", "sync", ".", "WaitGroup", "{", "}", "\n", "wg", ...
// Returns a array of channels that contains elements in each shard, // which likely takes a snapshot of `m`. // It returns once the size of each buffered channel is determined, // before all the channels are populated using goroutines.
[ "Returns", "a", "array", "of", "channels", "that", "contains", "elements", "in", "each", "shard", "which", "likely", "takes", "a", "snapshot", "of", "m", ".", "It", "returns", "once", "the", "size", "of", "each", "buffered", "channel", "is", "determined", ...
2693aad1ed7517c2bb5b3a42cb8fde88b941d89d
https://github.com/orcaman/concurrent-map/blob/2693aad1ed7517c2bb5b3a42cb8fde88b941d89d/concurrent_map.go#L193-L213
146,570
orcaman/concurrent-map
concurrent_map.go
fanIn
func fanIn(chans []chan Tuple, out chan Tuple) { wg := sync.WaitGroup{} wg.Add(len(chans)) for _, ch := range chans { go func(ch chan Tuple) { for t := range ch { out <- t } wg.Done() }(ch) } wg.Wait() close(out) }
go
func fanIn(chans []chan Tuple, out chan Tuple) { wg := sync.WaitGroup{} wg.Add(len(chans)) for _, ch := range chans { go func(ch chan Tuple) { for t := range ch { out <- t } wg.Done() }(ch) } wg.Wait() close(out) }
[ "func", "fanIn", "(", "chans", "[", "]", "chan", "Tuple", ",", "out", "chan", "Tuple", ")", "{", "wg", ":=", "sync", ".", "WaitGroup", "{", "}", "\n", "wg", ".", "Add", "(", "len", "(", "chans", ")", ")", "\n", "for", "_", ",", "ch", ":=", "r...
// fanIn reads elements from channels `chans` into channel `out`
[ "fanIn", "reads", "elements", "from", "channels", "chans", "into", "channel", "out" ]
2693aad1ed7517c2bb5b3a42cb8fde88b941d89d
https://github.com/orcaman/concurrent-map/blob/2693aad1ed7517c2bb5b3a42cb8fde88b941d89d/concurrent_map.go#L216-L229
146,571
orcaman/concurrent-map
concurrent_map.go
IterCb
func (m ConcurrentMap) IterCb(fn IterCb) { for idx := range m { shard := (m)[idx] shard.RLock() for key, value := range shard.items { fn(key, value) } shard.RUnlock() } }
go
func (m ConcurrentMap) IterCb(fn IterCb) { for idx := range m { shard := (m)[idx] shard.RLock() for key, value := range shard.items { fn(key, value) } shard.RUnlock() } }
[ "func", "(", "m", "ConcurrentMap", ")", "IterCb", "(", "fn", "IterCb", ")", "{", "for", "idx", ":=", "range", "m", "{", "shard", ":=", "(", "m", ")", "[", "idx", "]", "\n", "shard", ".", "RLock", "(", ")", "\n", "for", "key", ",", "value", ":="...
// Callback based iterator, cheapest way to read // all elements in a map.
[ "Callback", "based", "iterator", "cheapest", "way", "to", "read", "all", "elements", "in", "a", "map", "." ]
2693aad1ed7517c2bb5b3a42cb8fde88b941d89d
https://github.com/orcaman/concurrent-map/blob/2693aad1ed7517c2bb5b3a42cb8fde88b941d89d/concurrent_map.go#L251-L260
146,572
orcaman/concurrent-map
concurrent_map.go
MarshalJSON
func (m ConcurrentMap) MarshalJSON() ([]byte, error) { // Create a temporary map, which will hold all item spread across shards. tmp := make(map[string]interface{}) // Insert items to temporary map. for item := range m.IterBuffered() { tmp[item.Key] = item.Val } return json.Marshal(tmp) }
go
func (m ConcurrentMap) MarshalJSON() ([]byte, error) { // Create a temporary map, which will hold all item spread across shards. tmp := make(map[string]interface{}) // Insert items to temporary map. for item := range m.IterBuffered() { tmp[item.Key] = item.Val } return json.Marshal(tmp) }
[ "func", "(", "m", "ConcurrentMap", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "// Create a temporary map, which will hold all item spread across shards.", "tmp", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}...
//Reviles ConcurrentMap "private" variables to json marshal.
[ "Reviles", "ConcurrentMap", "private", "variables", "to", "json", "marshal", "." ]
2693aad1ed7517c2bb5b3a42cb8fde88b941d89d
https://github.com/orcaman/concurrent-map/blob/2693aad1ed7517c2bb5b3a42cb8fde88b941d89d/concurrent_map.go#L294-L303
146,573
golang/example
gotypes/weave.go
include
func include(file, tag string) (string, error) { f, err := os.Open(file) if err != nil { return "", err } defer f.Close() startre, err := regexp.Compile("!\\+" + tag + "$") if err != nil { return "", err } endre, err := regexp.Compile("!\\-" + tag + "$") if err != nil { return "", err } var text byte...
go
func include(file, tag string) (string, error) { f, err := os.Open(file) if err != nil { return "", err } defer f.Close() startre, err := regexp.Compile("!\\+" + tag + "$") if err != nil { return "", err } endre, err := regexp.Compile("!\\-" + tag + "$") if err != nil { return "", err } var text byte...
[ "func", "include", "(", "file", ",", "tag", "string", ")", "(", "string", ",", "error", ")", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "file", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\...
// include processes an included file, and returns the included text. // Only lines between those matching !+tag and !-tag will be returned. // This is true even if tag=="".
[ "include", "processes", "an", "included", "file", "and", "returns", "the", "included", "text", ".", "Only", "lines", "between", "those", "matching", "!", "+", "tag", "and", "!", "-", "tag", "will", "be", "returned", ".", "This", "is", "true", "even", "if...
46695d81d1fae905a270fb7db8a4d11a334562fe
https://github.com/golang/example/blob/46695d81d1fae905a270fb7db8a4d11a334562fe/gotypes/weave.go#L105-L141
146,574
golang/example
gotypes/weave.go
cleanListing
func cleanListing(text string) string { lines := strings.Split(text, "\n") // remove minimum number of leading tabs from all non-blank lines tabs := 999 for i, line := range lines { if strings.TrimSpace(line) == "" { lines[i] = "" } else { if n := leadingTabs(line); n < tabs { tabs = n } } } f...
go
func cleanListing(text string) string { lines := strings.Split(text, "\n") // remove minimum number of leading tabs from all non-blank lines tabs := 999 for i, line := range lines { if strings.TrimSpace(line) == "" { lines[i] = "" } else { if n := leadingTabs(line); n < tabs { tabs = n } } } f...
[ "func", "cleanListing", "(", "text", "string", ")", "string", "{", "lines", ":=", "strings", ".", "Split", "(", "text", ",", "\"", "\\n", "\"", ")", "\n\n", "// remove minimum number of leading tabs from all non-blank lines", "tabs", ":=", "999", "\n", "for", "i...
// cleanListing removes entirely blank leading and trailing lines from // text, and removes n leading tabs.
[ "cleanListing", "removes", "entirely", "blank", "leading", "and", "trailing", "lines", "from", "text", "and", "removes", "n", "leading", "tabs", "." ]
46695d81d1fae905a270fb7db8a4d11a334562fe
https://github.com/golang/example/blob/46695d81d1fae905a270fb7db8a4d11a334562fe/gotypes/weave.go#L151-L181
146,575
golang/example
gotypes/typeandvalue/main.go
nodeString
func nodeString(n ast.Node) string { var buf bytes.Buffer format.Node(&buf, fset, n) return buf.String() }
go
func nodeString(n ast.Node) string { var buf bytes.Buffer format.Node(&buf, fset, n) return buf.String() }
[ "func", "nodeString", "(", "n", "ast", ".", "Node", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "format", ".", "Node", "(", "&", "buf", ",", "fset", ",", "n", ")", "\n", "return", "buf", ".", "String", "(", ")", "\n", "}" ]
// nodeString formats a syntax tree in the style of gofmt.
[ "nodeString", "formats", "a", "syntax", "tree", "in", "the", "style", "of", "gofmt", "." ]
46695d81d1fae905a270fb7db8a4d11a334562fe
https://github.com/golang/example/blob/46695d81d1fae905a270fb7db8a4d11a334562fe/gotypes/typeandvalue/main.go#L61-L65
146,576
golang/example
gotypes/typeandvalue/main.go
mode
func mode(tv types.TypeAndValue) string { s := "" if tv.IsVoid() { s += ",void" } if tv.IsType() { s += ",type" } if tv.IsBuiltin() { s += ",builtin" } if tv.IsValue() { s += ",value" } if tv.IsNil() { s += ",nil" } if tv.Addressable() { s += ",addressable" } if tv.Assignable() { s += ",assi...
go
func mode(tv types.TypeAndValue) string { s := "" if tv.IsVoid() { s += ",void" } if tv.IsType() { s += ",type" } if tv.IsBuiltin() { s += ",builtin" } if tv.IsValue() { s += ",value" } if tv.IsNil() { s += ",nil" } if tv.Addressable() { s += ",addressable" } if tv.Assignable() { s += ",assi...
[ "func", "mode", "(", "tv", "types", ".", "TypeAndValue", ")", "string", "{", "s", ":=", "\"", "\"", "\n", "if", "tv", ".", "IsVoid", "(", ")", "{", "s", "+=", "\"", "\"", "\n", "}", "\n", "if", "tv", ".", "IsType", "(", ")", "{", "s", "+=", ...
// mode returns a string describing the mode of an expression.
[ "mode", "returns", "a", "string", "describing", "the", "mode", "of", "an", "expression", "." ]
46695d81d1fae905a270fb7db8a4d11a334562fe
https://github.com/golang/example/blob/46695d81d1fae905a270fb7db8a4d11a334562fe/gotypes/typeandvalue/main.go#L68-L95
146,577
golang/example
outyet/main.go
NewServer
func NewServer(version, url string, period time.Duration) *Server { s := &Server{version: version, url: url, period: period} go s.poll() return s }
go
func NewServer(version, url string, period time.Duration) *Server { s := &Server{version: version, url: url, period: period} go s.poll() return s }
[ "func", "NewServer", "(", "version", ",", "url", "string", ",", "period", "time", ".", "Duration", ")", "*", "Server", "{", "s", ":=", "&", "Server", "{", "version", ":", "version", ",", "url", ":", "url", ",", "period", ":", "period", "}", "\n", "...
// NewServer returns an initialized outyet server.
[ "NewServer", "returns", "an", "initialized", "outyet", "server", "." ]
46695d81d1fae905a270fb7db8a4d11a334562fe
https://github.com/golang/example/blob/46695d81d1fae905a270fb7db8a4d11a334562fe/outyet/main.go#L70-L74
146,578
golang/example
outyet/main.go
poll
func (s *Server) poll() { for !isTagged(s.url) { pollSleep(s.period) } s.mu.Lock() s.yes = true s.mu.Unlock() pollDone() }
go
func (s *Server) poll() { for !isTagged(s.url) { pollSleep(s.period) } s.mu.Lock() s.yes = true s.mu.Unlock() pollDone() }
[ "func", "(", "s", "*", "Server", ")", "poll", "(", ")", "{", "for", "!", "isTagged", "(", "s", ".", "url", ")", "{", "pollSleep", "(", "s", ".", "period", ")", "\n", "}", "\n", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "s", ".", "yes", ...
// poll polls the change URL for the specified period until the tag exists. // Then it sets the Server's yes field true and exits.
[ "poll", "polls", "the", "change", "URL", "for", "the", "specified", "period", "until", "the", "tag", "exists", ".", "Then", "it", "sets", "the", "Server", "s", "yes", "field", "true", "and", "exits", "." ]
46695d81d1fae905a270fb7db8a4d11a334562fe
https://github.com/golang/example/blob/46695d81d1fae905a270fb7db8a4d11a334562fe/outyet/main.go#L78-L86
146,579
golang/example
outyet/main.go
isTagged
func isTagged(url string) bool { pollCount.Add(1) r, err := http.Head(url) if err != nil { log.Print(err) pollError.Set(err.Error()) pollErrorCount.Add(1) return false } return r.StatusCode == http.StatusOK }
go
func isTagged(url string) bool { pollCount.Add(1) r, err := http.Head(url) if err != nil { log.Print(err) pollError.Set(err.Error()) pollErrorCount.Add(1) return false } return r.StatusCode == http.StatusOK }
[ "func", "isTagged", "(", "url", "string", ")", "bool", "{", "pollCount", ".", "Add", "(", "1", ")", "\n", "r", ",", "err", ":=", "http", ".", "Head", "(", "url", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Print", "(", "err", ")", ...
// isTagged makes an HTTP HEAD request to the given URL and reports whether it // returned a 200 OK response.
[ "isTagged", "makes", "an", "HTTP", "HEAD", "request", "to", "the", "given", "URL", "and", "reports", "whether", "it", "returned", "a", "200", "OK", "response", "." ]
46695d81d1fae905a270fb7db8a4d11a334562fe
https://github.com/golang/example/blob/46695d81d1fae905a270fb7db8a4d11a334562fe/outyet/main.go#L96-L106
146,580
golang/example
outyet/main.go
ServeHTTP
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { hitCount.Add(1) s.mu.RLock() data := struct { URL string Version string Yes bool }{ s.url, s.version, s.yes, } s.mu.RUnlock() err := tmpl.Execute(w, data) if err != nil { log.Print(err) } }
go
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { hitCount.Add(1) s.mu.RLock() data := struct { URL string Version string Yes bool }{ s.url, s.version, s.yes, } s.mu.RUnlock() err := tmpl.Execute(w, data) if err != nil { log.Print(err) } }
[ "func", "(", "s", "*", "Server", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "hitCount", ".", "Add", "(", "1", ")", "\n", "s", ".", "mu", ".", "RLock", "(", ")", "\n", "data", ":="...
// ServeHTTP implements the HTTP user interface.
[ "ServeHTTP", "implements", "the", "HTTP", "user", "interface", "." ]
46695d81d1fae905a270fb7db8a4d11a334562fe
https://github.com/golang/example/blob/46695d81d1fae905a270fb7db8a4d11a334562fe/outyet/main.go#L109-L126
146,581
golang/example
gotypes/lookup/lookup.go
main
func main() { fset := token.NewFileSet() f, err := parser.ParseFile(fset, "hello.go", hello, parser.ParseComments) if err != nil { log.Fatal(err) // parse error } conf := types.Config{Importer: importer.Default()} pkg, err := conf.Check("cmd/hello", fset, []*ast.File{f}, nil) if err != nil { log.Fatal(err) ...
go
func main() { fset := token.NewFileSet() f, err := parser.ParseFile(fset, "hello.go", hello, parser.ParseComments) if err != nil { log.Fatal(err) // parse error } conf := types.Config{Importer: importer.Default()} pkg, err := conf.Check("cmd/hello", fset, []*ast.File{f}, nil) if err != nil { log.Fatal(err) ...
[ "func", "main", "(", ")", "{", "fset", ":=", "token", ".", "NewFileSet", "(", ")", "\n", "f", ",", "err", ":=", "parser", ".", "ParseFile", "(", "fset", ",", "\"", "\"", ",", "hello", ",", "parser", ".", "ParseComments", ")", "\n", "if", "err", "...
//!-input //!+main
[ "!", "-", "input", "!", "+", "main" ]
46695d81d1fae905a270fb7db8a4d11a334562fe
https://github.com/golang/example/blob/46695d81d1fae905a270fb7db8a4d11a334562fe/gotypes/lookup/lookup.go#L36-L62
146,582
golang/example
gotypes/implements/main.go
main
func main() { // Parse one file. fset := token.NewFileSet() f, err := parser.ParseFile(fset, "input.go", input, 0) if err != nil { log.Fatal(err) // parse error } conf := types.Config{Importer: importer.Default()} pkg, err := conf.Check("hello", fset, []*ast.File{f}, nil) if err != nil { log.Fatal(err) // t...
go
func main() { // Parse one file. fset := token.NewFileSet() f, err := parser.ParseFile(fset, "input.go", input, 0) if err != nil { log.Fatal(err) // parse error } conf := types.Config{Importer: importer.Default()} pkg, err := conf.Check("hello", fset, []*ast.File{f}, nil) if err != nil { log.Fatal(err) // t...
[ "func", "main", "(", ")", "{", "// Parse one file.", "fset", ":=", "token", ".", "NewFileSet", "(", ")", "\n", "f", ",", "err", ":=", "parser", ".", "ParseFile", "(", "fset", ",", "\"", "\"", ",", "input", ",", "0", ")", "\n", "if", "err", "!=", ...
//!-input
[ "!", "-", "input" ]
46695d81d1fae905a270fb7db8a4d11a334562fe
https://github.com/golang/example/blob/46695d81d1fae905a270fb7db8a4d11a334562fe/gotypes/implements/main.go#L29-L67
146,583
golang/example
template/main.go
indexHandler
func indexHandler(w http.ResponseWriter, r *http.Request) { data := &Index{ Title: "Image gallery", Body: "Welcome to the image gallery.", } for name, img := range images { data.Links = append(data.Links, Link{ URL: "/image/" + name, Title: img.Title, }) } if err := indexTemplate.Execute(w, data);...
go
func indexHandler(w http.ResponseWriter, r *http.Request) { data := &Index{ Title: "Image gallery", Body: "Welcome to the image gallery.", } for name, img := range images { data.Links = append(data.Links, Link{ URL: "/image/" + name, Title: img.Title, }) } if err := indexTemplate.Execute(w, data);...
[ "func", "indexHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "data", ":=", "&", "Index", "{", "Title", ":", "\"", "\"", ",", "Body", ":", "\"", "\"", ",", "}", "\n", "for", "name", ",", "img", ...
// indexHandler is an HTTP handler that serves the index page.
[ "indexHandler", "is", "an", "HTTP", "handler", "that", "serves", "the", "index", "page", "." ]
46695d81d1fae905a270fb7db8a4d11a334562fe
https://github.com/golang/example/blob/46695d81d1fae905a270fb7db8a4d11a334562fe/template/main.go#L55-L69
146,584
golang/example
template/main.go
imageHandler
func imageHandler(w http.ResponseWriter, r *http.Request) { data, ok := images[strings.TrimPrefix(r.URL.Path, "/image/")] if !ok { http.NotFound(w, r) return } if err := imageTemplate.Execute(w, data); err != nil { log.Println(err) } }
go
func imageHandler(w http.ResponseWriter, r *http.Request) { data, ok := images[strings.TrimPrefix(r.URL.Path, "/image/")] if !ok { http.NotFound(w, r) return } if err := imageTemplate.Execute(w, data); err != nil { log.Println(err) } }
[ "func", "imageHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "data", ",", "ok", ":=", "images", "[", "strings", ".", "TrimPrefix", "(", "r", ".", "URL", ".", "Path", ",", "\"", "\"", ")", "]", ...
// imageHandler is an HTTP handler that serves the image pages.
[ "imageHandler", "is", "an", "HTTP", "handler", "that", "serves", "the", "image", "pages", "." ]
46695d81d1fae905a270fb7db8a4d11a334562fe
https://github.com/golang/example/blob/46695d81d1fae905a270fb7db8a4d11a334562fe/template/main.go#L82-L91
146,585
kardianos/govendor
context/label.go
FindLabel
func FindLabel(version string, labels []Label) Label { list := make([]*labelAnalysis, 0, 6) exact := strings.HasPrefix(version, "=") version = strings.TrimPrefix(version, "=") for _, label := range labels { if exact { if label.Text == version { return label } continue } if !strings.HasPrefix(la...
go
func FindLabel(version string, labels []Label) Label { list := make([]*labelAnalysis, 0, 6) exact := strings.HasPrefix(version, "=") version = strings.TrimPrefix(version, "=") for _, label := range labels { if exact { if label.Text == version { return label } continue } if !strings.HasPrefix(la...
[ "func", "FindLabel", "(", "version", "string", ",", "labels", "[", "]", "Label", ")", "Label", "{", "list", ":=", "make", "(", "[", "]", "*", "labelAnalysis", ",", "0", ",", "6", ")", "\n\n", "exact", ":=", "strings", ".", "HasPrefix", "(", "version"...
// FindLabel matches a single label from a list of labels, given a version. // If the returning label.Source is LabelNone, then no labels match. // // Labels are first broken into sections separated by "-". Shortest wins. // If they have the same number of above sections, then they are compared // further. Number seque...
[ "FindLabel", "matches", "a", "single", "label", "from", "a", "list", "of", "labels", "given", "a", "version", ".", "If", "the", "returning", "label", ".", "Source", "is", "LabelNone", "then", "no", "labels", "match", ".", "Labels", "are", "first", "broken"...
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/label.go#L199-L240
146,586
kardianos/govendor
context/version.go
isVersion
func isVersion(s string) bool { hasPunct := false onlyNumber := true onlyHexLetter := true for _, r := range s { isNumber := unicode.IsNumber(r) isLetter := unicode.IsLetter(r) hasPunct = hasPunct || unicode.IsPunct(r) onlyNumber = onlyNumber && isNumber if isLetter { low := unicode.ToLower(r) onl...
go
func isVersion(s string) bool { hasPunct := false onlyNumber := true onlyHexLetter := true for _, r := range s { isNumber := unicode.IsNumber(r) isLetter := unicode.IsLetter(r) hasPunct = hasPunct || unicode.IsPunct(r) onlyNumber = onlyNumber && isNumber if isLetter { low := unicode.ToLower(r) onl...
[ "func", "isVersion", "(", "s", "string", ")", "bool", "{", "hasPunct", ":=", "false", "\n", "onlyNumber", ":=", "true", "\n", "onlyHexLetter", ":=", "true", "\n", "for", "_", ",", "r", ":=", "range", "s", "{", "isNumber", ":=", "unicode", ".", "IsNumbe...
// IsVersion returns true if the string is a version.
[ "IsVersion", "returns", "true", "if", "the", "string", "is", "a", "version", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/version.go#L13-L47
146,587
kardianos/govendor
context/path.go
isStdLib
func (ctx *Context) isStdLib(importPath string) (yes bool, err error) { if importPath == "builtin" || importPath == "unsafe" || importPath == "C" { yes = true return } dir := filepath.Join(ctx.Goroot, importPath) fi, _ := os.Stat(dir) if fi == nil { return } if !fi.IsDir() { return } yes, err = hasGo...
go
func (ctx *Context) isStdLib(importPath string) (yes bool, err error) { if importPath == "builtin" || importPath == "unsafe" || importPath == "C" { yes = true return } dir := filepath.Join(ctx.Goroot, importPath) fi, _ := os.Stat(dir) if fi == nil { return } if !fi.IsDir() { return } yes, err = hasGo...
[ "func", "(", "ctx", "*", "Context", ")", "isStdLib", "(", "importPath", "string", ")", "(", "yes", "bool", ",", "err", "error", ")", "{", "if", "importPath", "==", "\"", "\"", "||", "importPath", "==", "\"", "\"", "||", "importPath", "==", "\"", "\""...
// Import path is in GOROOT or is a special package.
[ "Import", "path", "is", "in", "GOROOT", "or", "is", "a", "special", "package", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/path.go#L16-L33
146,588
kardianos/govendor
context/path.go
findImportDir
func (ctx *Context) findImportDir(relative, importPath string) (dir, gopath string, err error) { if importPath == "builtin" || importPath == "unsafe" || importPath == "C" { return filepath.Join(ctx.Goroot, importPath), ctx.Goroot, nil } if len(relative) != 0 { rel := relative for { look := filepath.Join(rel...
go
func (ctx *Context) findImportDir(relative, importPath string) (dir, gopath string, err error) { if importPath == "builtin" || importPath == "unsafe" || importPath == "C" { return filepath.Join(ctx.Goroot, importPath), ctx.Goroot, nil } if len(relative) != 0 { rel := relative for { look := filepath.Join(rel...
[ "func", "(", "ctx", "*", "Context", ")", "findImportDir", "(", "relative", ",", "importPath", "string", ")", "(", "dir", ",", "gopath", "string", ",", "err", "error", ")", "{", "if", "importPath", "==", "\"", "\"", "||", "importPath", "==", "\"", "\"",...
// findImportDir finds the absolute directory. If rel is empty vendor folders // are not looked in.
[ "findImportDir", "finds", "the", "absolute", "directory", ".", "If", "rel", "is", "empty", "vendor", "folders", "are", "not", "looked", "in", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/path.go#L37-L90
146,589
kardianos/govendor
context/path.go
findImportPath
func (ctx *Context) findImportPath(dir string) (importPath, gopath string, err error) { dirResolved, err := filepath.EvalSymlinks(dir) if err != nil { return "", "", err } dirs := make([]string, 1) dirs = append(dirs, dir) if dir != dirResolved { dirs = append(dirs, dirResolved) } for _, gopath := range ct...
go
func (ctx *Context) findImportPath(dir string) (importPath, gopath string, err error) { dirResolved, err := filepath.EvalSymlinks(dir) if err != nil { return "", "", err } dirs := make([]string, 1) dirs = append(dirs, dir) if dir != dirResolved { dirs = append(dirs, dirResolved) } for _, gopath := range ct...
[ "func", "(", "ctx", "*", "Context", ")", "findImportPath", "(", "dir", "string", ")", "(", "importPath", ",", "gopath", "string", ",", "err", "error", ")", "{", "dirResolved", ",", "err", ":=", "filepath", ".", "EvalSymlinks", "(", "dir", ")", "\n", "i...
// findImportPath takes a absolute directory and returns the import path and go path.
[ "findImportPath", "takes", "a", "absolute", "directory", "and", "returns", "the", "import", "path", "and", "go", "path", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/path.go#L93-L114
146,590
kardianos/govendor
context/path.go
RemovePackage
func RemovePackage(path, root string, tree bool) error { // Ensure the path is empty of files. dir, err := os.Open(path) if err != nil { if os.IsNotExist(err) { return nil } return err } // Remove package files. fl, err := dir.Readdir(-1) dir.Close() if err != nil { return err } for _, fi := range...
go
func RemovePackage(path, root string, tree bool) error { // Ensure the path is empty of files. dir, err := os.Open(path) if err != nil { if os.IsNotExist(err) { return nil } return err } // Remove package files. fl, err := dir.Readdir(-1) dir.Close() if err != nil { return err } for _, fi := range...
[ "func", "RemovePackage", "(", "path", ",", "root", "string", ",", "tree", "bool", ")", "error", "{", "// Ensure the path is empty of files.", "dir", ",", "err", ":=", "os", ".", "Open", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "if", "os", ...
// RemovePackage removes the specified folder files. If folder is empty when // done (no nested folders, remove the folder and any empty parent folders.
[ "RemovePackage", "removes", "the", "specified", "folder", "files", ".", "If", "folder", "is", "empty", "when", "done", "(", "no", "nested", "folders", "remove", "the", "folder", "and", "any", "empty", "parent", "folders", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/path.go#L158-L235
146,591
kardianos/govendor
internal/gt/vcs.go
Setup
func (h *HttpHandler) Setup() VcsHandle { vcs := h.newer(h) vcs.create() h.g.onClean(vcs.remove) h.handles[vcs.pkg()] = vcs return vcs }
go
func (h *HttpHandler) Setup() VcsHandle { vcs := h.newer(h) vcs.create() h.g.onClean(vcs.remove) h.handles[vcs.pkg()] = vcs return vcs }
[ "func", "(", "h", "*", "HttpHandler", ")", "Setup", "(", ")", "VcsHandle", "{", "vcs", ":=", "h", ".", "newer", "(", "h", ")", "\n", "vcs", ".", "create", "(", ")", "\n", "h", ".", "g", ".", "onClean", "(", "vcs", ".", "remove", ")", "\n\n", ...
// Setup returns type with Remove function that can be defer'ed.
[ "Setup", "returns", "type", "with", "Remove", "function", "that", "can", "be", "defer", "ed", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/internal/gt/vcs.go#L65-L72
146,592
kardianos/govendor
context/resolve.go
loadPackage
func (ctx *Context) loadPackage() error { ctx.loaded = true ctx.dirty = false ctx.statusCache = nil ctx.Package = make(map[string]*Package, len(ctx.Package)) // We following the root symlink only in case the root of the repo is symlinked into the GOPATH // This could happen during on some CI that didn't checkout ...
go
func (ctx *Context) loadPackage() error { ctx.loaded = true ctx.dirty = false ctx.statusCache = nil ctx.Package = make(map[string]*Package, len(ctx.Package)) // We following the root symlink only in case the root of the repo is symlinked into the GOPATH // This could happen during on some CI that didn't checkout ...
[ "func", "(", "ctx", "*", "Context", ")", "loadPackage", "(", ")", "error", "{", "ctx", ".", "loaded", "=", "true", "\n", "ctx", ".", "dirty", "=", "false", "\n", "ctx", ".", "statusCache", "=", "nil", "\n", "ctx", ".", "Package", "=", "make", "(", ...
// loadPackage sets up the context with package information and // is called before any initial operation is performed.
[ "loadPackage", "sets", "up", "the", "context", "with", "package", "information", "and", "is", "called", "before", "any", "initial", "operation", "is", "performed", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/resolve.go#L36-L78
146,593
kardianos/govendor
vcs/vcs.go
RegisterVCS
func RegisterVCS(vcs Vcs) { registerSync.Lock() defer registerSync.Unlock() vcsRegistry = append(vcsRegistry, vcs) }
go
func RegisterVCS(vcs Vcs) { registerSync.Lock() defer registerSync.Unlock() vcsRegistry = append(vcsRegistry, vcs) }
[ "func", "RegisterVCS", "(", "vcs", "Vcs", ")", "{", "registerSync", ".", "Lock", "(", ")", "\n", "defer", "registerSync", ".", "Unlock", "(", ")", "\n\n", "vcsRegistry", "=", "append", "(", "vcsRegistry", ",", "vcs", ")", "\n", "}" ]
// RegisterVCS adds a new VCS to use.
[ "RegisterVCS", "adds", "a", "new", "VCS", "to", "use", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/vcs/vcs.go#L38-L43
146,594
kardianos/govendor
vcs/vcs.go
FindVcs
func FindVcs(root, packageDir string) (info *VcsInfo, err error) { if !filepath.IsAbs(root) { return nil, nil } if !filepath.IsAbs(packageDir) { return nil, nil } path := packageDir for i := 0; i <= looplimit; i++ { for _, vcs := range vcsRegistry { info, err = vcs.Find(path) if err != nil { retur...
go
func FindVcs(root, packageDir string) (info *VcsInfo, err error) { if !filepath.IsAbs(root) { return nil, nil } if !filepath.IsAbs(packageDir) { return nil, nil } path := packageDir for i := 0; i <= looplimit; i++ { for _, vcs := range vcsRegistry { info, err = vcs.Find(path) if err != nil { retur...
[ "func", "FindVcs", "(", "root", ",", "packageDir", "string", ")", "(", "info", "*", "VcsInfo", ",", "err", "error", ")", "{", "if", "!", "filepath", ".", "IsAbs", "(", "root", ")", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "if", "!", "fi...
// FindVcs determines the version control information given a package dir and // lowest root dir.
[ "FindVcs", "determines", "the", "version", "control", "information", "given", "a", "package", "dir", "and", "lowest", "root", "dir", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/vcs/vcs.go#L49-L79
146,595
kardianos/govendor
migrate/migrate.go
MigrateWD
func MigrateWD(from From) error { wd, err := os.Getwd() if err != nil { return err } return Migrate(from, wd) }
go
func MigrateWD(from From) error { wd, err := os.Getwd() if err != nil { return err } return Migrate(from, wd) }
[ "func", "MigrateWD", "(", "from", "From", ")", "error", "{", "wd", ",", "err", ":=", "os", ".", "Getwd", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "Migrate", "(", "from", ",", "wd", ")", "\n", "}...
// Migrate from the given system using the current working directory.
[ "Migrate", "from", "the", "given", "system", "using", "the", "current", "working", "directory", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/migrate/migrate.go#L30-L36
146,596
kardianos/govendor
migrate/migrate.go
SystemList
func SystemList() []string { list := make([]string, 0, len(registered)) for key := range registered { list = append(list, string(key)) } sort.Strings(list) return list }
go
func SystemList() []string { list := make([]string, 0, len(registered)) for key := range registered { list = append(list, string(key)) } sort.Strings(list) return list }
[ "func", "SystemList", "(", ")", "[", "]", "string", "{", "list", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "registered", ")", ")", "\n", "for", "key", ":=", "range", "registered", "{", "list", "=", "append", "(", "list", "...
// SystemList list available migration systems.
[ "SystemList", "list", "available", "migration", "systems", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/migrate/migrate.go#L39-L46
146,597
kardianos/govendor
migrate/migrate.go
Migrate
func Migrate(from From, root string) error { sys, found := registered[from] if !found { return ErrNoSuchSystem{ NotExist: string(from), Has: SystemList(), } } sys, err := sys.Check(root) if err != nil { return err } if sys == nil { return errors.New("Root not found.") } return sys.Migrate(ro...
go
func Migrate(from From, root string) error { sys, found := registered[from] if !found { return ErrNoSuchSystem{ NotExist: string(from), Has: SystemList(), } } sys, err := sys.Check(root) if err != nil { return err } if sys == nil { return errors.New("Root not found.") } return sys.Migrate(ro...
[ "func", "Migrate", "(", "from", "From", ",", "root", "string", ")", "error", "{", "sys", ",", "found", ":=", "registered", "[", "from", "]", "\n", "if", "!", "found", "{", "return", "ErrNoSuchSystem", "{", "NotExist", ":", "string", "(", "from", ")", ...
// Migrate from the given system using the given root.
[ "Migrate", "from", "the", "given", "system", "using", "the", "given", "root", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/migrate/migrate.go#L49-L65
146,598
kardianos/govendor
run/run.go
Run
func Run(w io.Writer, appArgs []string, ask prompt.Prompt) (help.HelpMessage, error) { r := &runner{} return r.run(w, appArgs, ask) }
go
func Run(w io.Writer, appArgs []string, ask prompt.Prompt) (help.HelpMessage, error) { r := &runner{} return r.run(w, appArgs, ask) }
[ "func", "Run", "(", "w", "io", ".", "Writer", ",", "appArgs", "[", "]", "string", ",", "ask", "prompt", ".", "Prompt", ")", "(", "help", ".", "HelpMessage", ",", "error", ")", "{", "r", ":=", "&", "runner", "{", "}", "\n", "return", "r", ".", "...
// Run is isoloated from main and os.Args to help with testing. // Shouldn't directly print to console, just write through w.
[ "Run", "is", "isoloated", "from", "main", "and", "os", ".", "Args", "to", "help", "with", "testing", ".", "Shouldn", "t", "directly", "print", "to", "console", "just", "write", "through", "w", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/run/run.go#L42-L45
146,599
kardianos/govendor
context/license.go
licenseWalk
func licenseWalk(root, startIn string, found func(folder, name string) error) error { folder := startIn for i := 0; i <= looplimit; i++ { dir, err := os.Open(folder) if err != nil { return err } fl, err := dir.Readdir(-1) dir.Close() if err != nil { return err } for _, fi := range fl { name ...
go
func licenseWalk(root, startIn string, found func(folder, name string) error) error { folder := startIn for i := 0; i <= looplimit; i++ { dir, err := os.Open(folder) if err != nil { return err } fl, err := dir.Readdir(-1) dir.Close() if err != nil { return err } for _, fi := range fl { name ...
[ "func", "licenseWalk", "(", "root", ",", "startIn", "string", ",", "found", "func", "(", "folder", ",", "name", "string", ")", "error", ")", "error", "{", "folder", ":=", "startIn", "\n", "for", "i", ":=", "0", ";", "i", "<=", "looplimit", ";", "i", ...
// licenseWalk starts in a folder and searches up the folder tree // for license like files. Found files are reported to the found function.
[ "licenseWalk", "starts", "in", "a", "folder", "and", "searches", "up", "the", "folder", "tree", "for", "license", "like", "files", ".", "Found", "files", "are", "reported", "to", "the", "found", "function", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/license.go#L110-L153