id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
24,500
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
24,501
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
24,502
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
24,503
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
24,504
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
24,505
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
24,506
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
24,507
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
24,508
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
24,509
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
24,510
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
24,511
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
24,512
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
24,513
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
24,514
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
24,515
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
24,516
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
24,517
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
24,518
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
24,519
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
24,520
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
24,521
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
24,522
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
24,523
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
24,524
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
24,525
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
24,526
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
24,527
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
24,528
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
24,529
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
24,530
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
24,531
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
24,532
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
24,533
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
24,534
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
24,535
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
24,536
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
24,537
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
24,538
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
24,539
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
24,540
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
24,541
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
24,542
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
24,543
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
24,544
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
24,545
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
24,546
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
24,547
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
24,548
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
24,549
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
24,550
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
24,551
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
24,552
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
24,553
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
24,554
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
24,555
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
24,556
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
24,557
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
24,558
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
24,559
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
24,560
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
24,561
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
24,562
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
24,563
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
24,564
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
24,565
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
24,566
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
24,567
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
24,568
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
24,569
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
24,570
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
24,571
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
24,572
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
24,573
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
24,574
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
24,575
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
24,576
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
24,577
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
24,578
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
24,579
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
24,580
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
24,581
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
24,582
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
24,583
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
24,584
kardianos/govendor
context/license.go
licenseCopy
func licenseCopy(root, startIn, vendorRoot, pkgPath string) error { addTo, _ := pathos.TrimCommonSuffix(pathos.SlashToFilepath(pkgPath), startIn) startIn = filepath.Clean(filepath.Join(startIn, "..")) return licenseWalk(root, startIn, func(folder, name string) error { srcPath := filepath.Join(folder, name) trimT...
go
func licenseCopy(root, startIn, vendorRoot, pkgPath string) error { addTo, _ := pathos.TrimCommonSuffix(pathos.SlashToFilepath(pkgPath), startIn) startIn = filepath.Clean(filepath.Join(startIn, "..")) return licenseWalk(root, startIn, func(folder, name string) error { srcPath := filepath.Join(folder, name) trimT...
[ "func", "licenseCopy", "(", "root", ",", "startIn", ",", "vendorRoot", ",", "pkgPath", "string", ")", "error", "{", "addTo", ",", "_", ":=", "pathos", ".", "TrimCommonSuffix", "(", "pathos", ".", "SlashToFilepath", "(", "pkgPath", ")", ",", "startIn", ")",...
// licenseCopy starts the search in the parent of "startIn" folder. // Looks in all sub-folders until root is reached. The root itself is not // searched.
[ "licenseCopy", "starts", "the", "search", "in", "the", "parent", "of", "startIn", "folder", ".", "Looks", "in", "all", "sub", "-", "folders", "until", "root", "is", "reached", ".", "The", "root", "itself", "is", "not", "searched", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/license.go#L158-L185
24,585
kardianos/govendor
context/license.go
LicenseDiscover
func LicenseDiscover(root, startIn, overridePath string, list map[string]License) error { return licenseWalk(root, startIn, func(folder, name string) error { ipath := pathos.SlashToImportPath(strings.TrimPrefix(folder, root)) if len(overridePath) > 0 { ipath = overridePath } if _, found := list[ipath]; foun...
go
func LicenseDiscover(root, startIn, overridePath string, list map[string]License) error { return licenseWalk(root, startIn, func(folder, name string) error { ipath := pathos.SlashToImportPath(strings.TrimPrefix(folder, root)) if len(overridePath) > 0 { ipath = overridePath } if _, found := list[ipath]; foun...
[ "func", "LicenseDiscover", "(", "root", ",", "startIn", ",", "overridePath", "string", ",", "list", "map", "[", "string", "]", "License", ")", "error", "{", "return", "licenseWalk", "(", "root", ",", "startIn", ",", "func", "(", "folder", ",", "name", "s...
// LicenseDiscover looks for license files in a given path.
[ "LicenseDiscover", "looks", "for", "license", "files", "in", "a", "given", "path", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/license.go#L197-L219
24,586
kardianos/govendor
context/sync.go
run1
func (vcsCmd *VCSCmd) run1(dir string, cmdline string, keyval []string, verbose bool) ([]byte, error) { v := vcsCmd.Cmd m := make(map[string]string) for i := 0; i < len(keyval); i += 2 { m[keyval[i]] = keyval[i+1] } args := strings.Fields(cmdline) for i, arg := range args { args[i] = expand(m, arg) } _, er...
go
func (vcsCmd *VCSCmd) run1(dir string, cmdline string, keyval []string, verbose bool) ([]byte, error) { v := vcsCmd.Cmd m := make(map[string]string) for i := 0; i < len(keyval); i += 2 { m[keyval[i]] = keyval[i+1] } args := strings.Fields(cmdline) for i, arg := range args { args[i] = expand(m, arg) } _, er...
[ "func", "(", "vcsCmd", "*", "VCSCmd", ")", "run1", "(", "dir", "string", ",", "cmdline", "string", ",", "keyval", "[", "]", "string", ",", "verbose", "bool", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "v", ":=", "vcsCmd", ".", "Cmd", "\n...
// run1 is the generalized implementation of run and runOutput.
[ "run1", "is", "the", "generalized", "implementation", "of", "run", "and", "runOutput", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/sync.go#L155-L194
24,587
kardianos/govendor
context/sync.go
mergeEnvLists
func mergeEnvLists(in, out []string) []string { NextVar: for _, inkv := range in { k := strings.SplitAfterN(inkv, "=", 2)[0] for i, outkv := range out { if strings.HasPrefix(outkv, k) { out[i] = inkv continue NextVar } } out = append(out, inkv) } return out }
go
func mergeEnvLists(in, out []string) []string { NextVar: for _, inkv := range in { k := strings.SplitAfterN(inkv, "=", 2)[0] for i, outkv := range out { if strings.HasPrefix(outkv, k) { out[i] = inkv continue NextVar } } out = append(out, inkv) } return out }
[ "func", "mergeEnvLists", "(", "in", ",", "out", "[", "]", "string", ")", "[", "]", "string", "{", "NextVar", ":", "for", "_", ",", "inkv", ":=", "range", "in", "{", "k", ":=", "strings", ".", "SplitAfterN", "(", "inkv", ",", "\"", "\"", ",", "2",...
// mergeEnvLists merges the two environment lists such that // variables with the same name in "in" replace those in "out".
[ "mergeEnvLists", "merges", "the", "two", "environment", "lists", "such", "that", "variables", "with", "the", "same", "name", "in", "in", "replace", "those", "in", "out", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/sync.go#L218-L231
24,588
kardianos/govendor
internal/pathos/path.go
ParseGoEnvLine
func ParseGoEnvLine(line string) (key, value string, ok bool) { // Remove any leading "set " found on windows. // Match the name to the env var + "=". // Remove any quotes. // Return result. line = strings.TrimPrefix(line, "set ") parts := strings.SplitN(line, "=", 2) if len(parts) < 2 { return "", "", false ...
go
func ParseGoEnvLine(line string) (key, value string, ok bool) { // Remove any leading "set " found on windows. // Match the name to the env var + "=". // Remove any quotes. // Return result. line = strings.TrimPrefix(line, "set ") parts := strings.SplitN(line, "=", 2) if len(parts) < 2 { return "", "", false ...
[ "func", "ParseGoEnvLine", "(", "line", "string", ")", "(", "key", ",", "value", "string", ",", "ok", "bool", ")", "{", "// Remove any leading \"set \" found on windows.", "// Match the name to the env var + \"=\".", "// Remove any quotes.", "// Return result.", "line", "=",...
// ParseGoEnvLine parses a "go env" line into a key value pair.
[ "ParseGoEnvLine", "parses", "a", "go", "env", "line", "into", "a", "key", "value", "pair", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/internal/pathos/path.go#L121-L137
24,589
kardianos/govendor
internal/pathos/path.go
GoEnv
func GoEnv(name, line string) (value string, ok bool) { // Remove any leading "set " found on windows. // Match the name to the env var + "=". // Remove any quotes. // Return result. line = strings.TrimPrefix(line, "set ") if len(line) < len(name)+1 { return "", false } if name != line[:len(name)] || line[len...
go
func GoEnv(name, line string) (value string, ok bool) { // Remove any leading "set " found on windows. // Match the name to the env var + "=". // Remove any quotes. // Return result. line = strings.TrimPrefix(line, "set ") if len(line) < len(name)+1 { return "", false } if name != line[:len(name)] || line[len...
[ "func", "GoEnv", "(", "name", ",", "line", "string", ")", "(", "value", "string", ",", "ok", "bool", ")", "{", "// Remove any leading \"set \" found on windows.", "// Match the name to the env var + \"=\".", "// Remove any quotes.", "// Return result.", "line", "=", "stri...
// GoEnv parses a "go env" line and checks for a specific // variable name.
[ "GoEnv", "parses", "a", "go", "env", "line", "and", "checks", "for", "a", "specific", "variable", "name", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/internal/pathos/path.go#L141-L158
24,590
kardianos/govendor
context/modify.go
ModifyStatus
func (ctx *Context) ModifyStatus(sg StatusGroup, mod Modify, mops ...ModifyOption) error { if ctx.added == nil { ctx.added = make(map[string]bool, 10) } list, err := ctx.Status() if err != nil { return err } // Add packages from status. statusLoop: for _, item := range list { if !item.Status.MatchGroup(s...
go
func (ctx *Context) ModifyStatus(sg StatusGroup, mod Modify, mops ...ModifyOption) error { if ctx.added == nil { ctx.added = make(map[string]bool, 10) } list, err := ctx.Status() if err != nil { return err } // Add packages from status. statusLoop: for _, item := range list { if !item.Status.MatchGroup(s...
[ "func", "(", "ctx", "*", "Context", ")", "ModifyStatus", "(", "sg", "StatusGroup", ",", "mod", "Modify", ",", "mops", "...", "ModifyOption", ")", "error", "{", "if", "ctx", ".", "added", "==", "nil", "{", "ctx", ".", "added", "=", "make", "(", "map",...
// ModifyStatus adds packages to the context by status.
[ "ModifyStatus", "adds", "packages", "to", "the", "context", "by", "status", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/modify.go#L113-L162
24,591
kardianos/govendor
context/modify.go
ModifyImport
func (ctx *Context) ModifyImport(imp *pkgspec.Pkg, mod Modify, mops ...ModifyOption) error { var err error if ctx.added == nil { ctx.added = make(map[string]bool, 10) } // Grap the origin of the pkg spec from the vendor file as needed. if len(imp.Origin) == 0 { for _, vpkg := range ctx.VendorFile.Package { ...
go
func (ctx *Context) ModifyImport(imp *pkgspec.Pkg, mod Modify, mops ...ModifyOption) error { var err error if ctx.added == nil { ctx.added = make(map[string]bool, 10) } // Grap the origin of the pkg spec from the vendor file as needed. if len(imp.Origin) == 0 { for _, vpkg := range ctx.VendorFile.Package { ...
[ "func", "(", "ctx", "*", "Context", ")", "ModifyImport", "(", "imp", "*", "pkgspec", ".", "Pkg", ",", "mod", "Modify", ",", "mops", "...", "ModifyOption", ")", "error", "{", "var", "err", "error", "\n", "if", "ctx", ".", "added", "==", "nil", "{", ...
// ModifyImport adds the package to the context.
[ "ModifyImport", "adds", "the", "package", "to", "the", "context", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/modify.go#L165-L217
24,592
kardianos/govendor
context/modify.go
modifyFetch
func (ctx *Context) modifyFetch(pkg *Package, uncommitted, hasVersion bool, version string) error { vp := ctx.VendorFilePackagePath(pkg.Path) if vp == nil { vp = &vendorfile.Package{ Add: true, Path: pkg.Path, } ctx.VendorFile.Package = append(ctx.VendorFile.Package, vp) } if hasVersion { vp.Version ...
go
func (ctx *Context) modifyFetch(pkg *Package, uncommitted, hasVersion bool, version string) error { vp := ctx.VendorFilePackagePath(pkg.Path) if vp == nil { vp = &vendorfile.Package{ Add: true, Path: pkg.Path, } ctx.VendorFile.Package = append(ctx.VendorFile.Package, vp) } if hasVersion { vp.Version ...
[ "func", "(", "ctx", "*", "Context", ")", "modifyFetch", "(", "pkg", "*", "Package", ",", "uncommitted", ",", "hasVersion", "bool", ",", "version", "string", ")", "error", "{", "vp", ":=", "ctx", ".", "VendorFilePackagePath", "(", "pkg", ".", "Path", ")",...
// modify function to fetch given package.
[ "modify", "function", "to", "fetch", "given", "package", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/modify.go#L502-L539
24,593
kardianos/govendor
context/modify.go
Check
func (ctx *Context) Check() []*Conflict { // Find duplicate packages that have been marked for moving. findDups := make(map[string][]*Operation, 3) // map[canonical][]local for _, op := range ctx.Operation { if op.State != OpReady { continue } findDups[op.Pkg.Path] = append(findDups[op.Pkg.Path], op) } v...
go
func (ctx *Context) Check() []*Conflict { // Find duplicate packages that have been marked for moving. findDups := make(map[string][]*Operation, 3) // map[canonical][]local for _, op := range ctx.Operation { if op.State != OpReady { continue } findDups[op.Pkg.Path] = append(findDups[op.Pkg.Path], op) } v...
[ "func", "(", "ctx", "*", "Context", ")", "Check", "(", ")", "[", "]", "*", "Conflict", "{", "// Find duplicate packages that have been marked for moving.", "findDups", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "*", "Operation", ",", "3", ")", ...
// Check returns any conflicts when more than one package can be moved into // the same path.
[ "Check", "returns", "any", "conflicts", "when", "more", "than", "one", "package", "can", "be", "moved", "into", "the", "same", "path", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/modify.go#L543-L566
24,594
kardianos/govendor
context/modify.go
ResloveApply
func (ctx *Context) ResloveApply(cc []*Conflict) { for _, c := range cc { if !c.Resolved { continue } for i, op := range c.Operation { if op.State != OpReady { continue } if i == c.OpIndex { if vp := ctx.VendorFilePackagePath(c.Canonical); vp != nil { vp.Origin = c.Local } contin...
go
func (ctx *Context) ResloveApply(cc []*Conflict) { for _, c := range cc { if !c.Resolved { continue } for i, op := range c.Operation { if op.State != OpReady { continue } if i == c.OpIndex { if vp := ctx.VendorFilePackagePath(c.Canonical); vp != nil { vp.Origin = c.Local } contin...
[ "func", "(", "ctx", "*", "Context", ")", "ResloveApply", "(", "cc", "[", "]", "*", "Conflict", ")", "{", "for", "_", ",", "c", ":=", "range", "cc", "{", "if", "!", "c", ".", "Resolved", "{", "continue", "\n", "}", "\n", "for", "i", ",", "op", ...
// ResolveApply applies the conflict resolution selected. It chooses the // Operation listed in the OpIndex field.
[ "ResolveApply", "applies", "the", "conflict", "resolution", "selected", ".", "It", "chooses", "the", "Operation", "listed", "in", "the", "OpIndex", "field", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/modify.go#L570-L588
24,595
kardianos/govendor
context/modify.go
ResolveAutoLongestPath
func ResolveAutoLongestPath(cc []*Conflict) []*Conflict { for _, c := range cc { if c.Resolved { continue } longestLen := 0 longestIndex := 0 for i, op := range c.Operation { if op.State != OpReady { continue } if len(op.Pkg.Local) > longestLen { longestLen = len(op.Pkg.Local) longes...
go
func ResolveAutoLongestPath(cc []*Conflict) []*Conflict { for _, c := range cc { if c.Resolved { continue } longestLen := 0 longestIndex := 0 for i, op := range c.Operation { if op.State != OpReady { continue } if len(op.Pkg.Local) > longestLen { longestLen = len(op.Pkg.Local) longes...
[ "func", "ResolveAutoLongestPath", "(", "cc", "[", "]", "*", "Conflict", ")", "[", "]", "*", "Conflict", "{", "for", "_", ",", "c", ":=", "range", "cc", "{", "if", "c", ".", "Resolved", "{", "continue", "\n", "}", "\n", "longestLen", ":=", "0", "\n"...
// ResolveAutoLongestPath finds the longest local path in each conflict // and set it to be used.
[ "ResolveAutoLongestPath", "finds", "the", "longest", "local", "path", "in", "each", "conflict", "and", "set", "it", "to", "be", "used", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/modify.go#L592-L613
24,596
kardianos/govendor
context/modify.go
ResolveAutoVendorFileOrigin
func (ctx *Context) ResolveAutoVendorFileOrigin(cc []*Conflict) []*Conflict { for _, c := range cc { if c.Resolved { continue } vp := ctx.VendorFilePackagePath(c.Canonical) if vp == nil { continue } // If this was just added, we still can't rely on it. // We still need to ask user. if vp.Add { ...
go
func (ctx *Context) ResolveAutoVendorFileOrigin(cc []*Conflict) []*Conflict { for _, c := range cc { if c.Resolved { continue } vp := ctx.VendorFilePackagePath(c.Canonical) if vp == nil { continue } // If this was just added, we still can't rely on it. // We still need to ask user. if vp.Add { ...
[ "func", "(", "ctx", "*", "Context", ")", "ResolveAutoVendorFileOrigin", "(", "cc", "[", "]", "*", "Conflict", ")", "[", "]", "*", "Conflict", "{", "for", "_", ",", "c", ":=", "range", "cc", "{", "if", "c", ".", "Resolved", "{", "continue", "\n", "}...
// ResolveAutoVendorFileOrigin resolves conflicts based on the vendor file // if possible.
[ "ResolveAutoVendorFileOrigin", "resolves", "conflicts", "based", "on", "the", "vendor", "file", "if", "possible", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/modify.go#L642-L673
24,597
kardianos/govendor
context/modify.go
Alter
func (ctx *Context) Alter() error { ctx.added = nil // Ensure there are no conflicts at this time. buf := &bytes.Buffer{} for _, conflict := range ctx.Check() { buf.WriteString(fmt.Sprintf("Different Canonical Packages for %s\n", conflict.Canonical)) for _, op := range conflict.Operation { buf.WriteString(fm...
go
func (ctx *Context) Alter() error { ctx.added = nil // Ensure there are no conflicts at this time. buf := &bytes.Buffer{} for _, conflict := range ctx.Check() { buf.WriteString(fmt.Sprintf("Different Canonical Packages for %s\n", conflict.Canonical)) for _, op := range conflict.Operation { buf.WriteString(fm...
[ "func", "(", "ctx", "*", "Context", ")", "Alter", "(", ")", "error", "{", "ctx", ".", "added", "=", "nil", "\n", "// Ensure there are no conflicts at this time.", "buf", ":=", "&", "bytes", ".", "Buffer", "{", "}", "\n", "for", "_", ",", "conflict", ":="...
// Alter runs any requested package alterations.
[ "Alter", "runs", "any", "requested", "package", "alterations", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/context/modify.go#L676-L754
24,598
kardianos/govendor
internal/gt/gopath.go
In
func (g *GopathTest) In(pkg string) { g.pkg = pkg p := g.Path(pkg) err := os.Chdir(p) if err != nil { g.Fatal(err) } g.current = p }
go
func (g *GopathTest) In(pkg string) { g.pkg = pkg p := g.Path(pkg) err := os.Chdir(p) if err != nil { g.Fatal(err) } g.current = p }
[ "func", "(", "g", "*", "GopathTest", ")", "In", "(", "pkg", "string", ")", "{", "g", ".", "pkg", "=", "pkg", "\n", "p", ":=", "g", ".", "Path", "(", "pkg", ")", "\n", "err", ":=", "os", ".", "Chdir", "(", "p", ")", "\n", "if", "err", "!=", ...
// In sets the current directory as an import path.
[ "In", "sets", "the", "current", "directory", "as", "an", "import", "path", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/internal/gt/gopath.go#L75-L83
24,599
kardianos/govendor
internal/gt/gopath.go
Path
func (g *GopathTest) Path(pkg string) string { return filepath.Join(g.base, "src", pkg) }
go
func (g *GopathTest) Path(pkg string) string { return filepath.Join(g.base, "src", pkg) }
[ "func", "(", "g", "*", "GopathTest", ")", "Path", "(", "pkg", "string", ")", "string", "{", "return", "filepath", ".", "Join", "(", "g", ".", "base", ",", "\"", "\"", ",", "pkg", ")", "\n", "}" ]
// Get path from package import path pkg.
[ "Get", "path", "from", "package", "import", "path", "pkg", "." ]
d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62
https://github.com/kardianos/govendor/blob/d0fd0db8a43d4b87c2ce416f60ae78407f3f3c62/internal/gt/gopath.go#L86-L88