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
20,900
deis/deis
client/cmd/apps.go
AppLogs
func AppLogs(appID string, lines int) error { c, appID, err := load(appID) if err != nil { return err } logs, err := apps.Logs(c, appID, lines) if err != nil { return err } return printLogs(logs) }
go
func AppLogs(appID string, lines int) error { c, appID, err := load(appID) if err != nil { return err } logs, err := apps.Logs(c, appID, lines) if err != nil { return err } return printLogs(logs) }
[ "func", "AppLogs", "(", "appID", "string", ",", "lines", "int", ")", "error", "{", "c", ",", "appID", ",", "err", ":=", "load", "(", "appID", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "logs", ",", "err", ":="...
// AppLogs returns the logs from an app.
[ "AppLogs", "returns", "the", "logs", "from", "an", "app", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/apps.go#L155-L169
20,901
deis/deis
client/cmd/apps.go
printLogs
func printLogs(logs string) error { for _, log := range strings.Split(logs, "\n") { category := "unknown" parts := strings.Split(strings.Split(log, ": ")[0], " ") if len(parts) >= 2 { category = parts[1] } colorVars := map[string]string{ "Color": chooseColor(category), "Log": log, } fmt.Printl...
go
func printLogs(logs string) error { for _, log := range strings.Split(logs, "\n") { category := "unknown" parts := strings.Split(strings.Split(log, ": ")[0], " ") if len(parts) >= 2 { category = parts[1] } colorVars := map[string]string{ "Color": chooseColor(category), "Log": log, } fmt.Printl...
[ "func", "printLogs", "(", "logs", "string", ")", "error", "{", "for", "_", ",", "log", ":=", "range", "strings", ".", "Split", "(", "logs", ",", "\"", "\\n", "\"", ")", "{", "category", ":=", "\"", "\"", "\n", "parts", ":=", "strings", ".", "Split"...
// printLogs prints each log line with a color matched to its category.
[ "printLogs", "prints", "each", "log", "line", "with", "a", "color", "matched", "to", "its", "category", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/apps.go#L172-L187
20,902
deis/deis
client/cmd/apps.go
AppRun
func AppRun(appID, command string) error { c, appID, err := load(appID) if err != nil { return err } fmt.Printf("Running '%s'...\n", command) out, err := apps.Run(c, appID, command) if err != nil { return err } fmt.Print(out.Output) os.Exit(out.ReturnCode) return nil }
go
func AppRun(appID, command string) error { c, appID, err := load(appID) if err != nil { return err } fmt.Printf("Running '%s'...\n", command) out, err := apps.Run(c, appID, command) if err != nil { return err } fmt.Print(out.Output) os.Exit(out.ReturnCode) return nil }
[ "func", "AppRun", "(", "appID", ",", "command", "string", ")", "error", "{", "c", ",", "appID", ",", "err", ":=", "load", "(", "appID", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "fmt", ".", "Printf", "(", "\"...
// AppRun runs a one time command in the app.
[ "AppRun", "runs", "a", "one", "time", "command", "in", "the", "app", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/apps.go#L190-L208
20,903
deis/deis
client/cmd/apps.go
AppDestroy
func AppDestroy(appID, confirm string) error { gitSession := false c, err := client.New() if err != nil { return err } if appID == "" { appID, err = git.DetectAppName(c.ControllerURL.Host) if err != nil { return err } gitSession = true } if confirm == "" { fmt.Printf(` ! WARNING: Potentia...
go
func AppDestroy(appID, confirm string) error { gitSession := false c, err := client.New() if err != nil { return err } if appID == "" { appID, err = git.DetectAppName(c.ControllerURL.Host) if err != nil { return err } gitSession = true } if confirm == "" { fmt.Printf(` ! WARNING: Potentia...
[ "func", "AppDestroy", "(", "appID", ",", "confirm", "string", ")", "error", "{", "gitSession", ":=", "false", "\n\n", "c", ",", "err", ":=", "client", ".", "New", "(", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", ...
// AppDestroy destroys an app.
[ "AppDestroy", "destroys", "an", "app", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/apps.go#L211-L258
20,904
deis/deis
client/cmd/apps.go
AppTransfer
func AppTransfer(appID, username string) error { c, appID, err := load(appID) if err != nil { return err } fmt.Printf("Transferring %s to %s... ", appID, username) err = apps.Transfer(c, appID, username) if err != nil { return err } fmt.Println("done") return nil }
go
func AppTransfer(appID, username string) error { c, appID, err := load(appID) if err != nil { return err } fmt.Printf("Transferring %s to %s... ", appID, username) err = apps.Transfer(c, appID, username) if err != nil { return err } fmt.Println("done") return nil }
[ "func", "AppTransfer", "(", "appID", ",", "username", "string", ")", "error", "{", "c", ",", "appID", ",", "err", ":=", "load", "(", "appID", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "fmt", ".", "Printf", "(",...
// AppTransfer transfers app ownership to another user.
[ "AppTransfer", "transfers", "app", "ownership", "to", "another", "user", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/apps.go#L261-L279
20,905
deis/deis
client/controller/models/users/users.go
List
func List(c *client.Client, results int) (api.Users, int, error) { body, count, err := c.LimitedRequest("/v1/users/", results) if err != nil { return []api.User{}, -1, err } var users []api.User if err = json.Unmarshal([]byte(body), &users); err != nil { return []api.User{}, -1, err } return users, count,...
go
func List(c *client.Client, results int) (api.Users, int, error) { body, count, err := c.LimitedRequest("/v1/users/", results) if err != nil { return []api.User{}, -1, err } var users []api.User if err = json.Unmarshal([]byte(body), &users); err != nil { return []api.User{}, -1, err } return users, count,...
[ "func", "List", "(", "c", "*", "client", ".", "Client", ",", "results", "int", ")", "(", "api", ".", "Users", ",", "int", ",", "error", ")", "{", "body", ",", "count", ",", "err", ":=", "c", ".", "LimitedRequest", "(", "\"", "\"", ",", "results",...
// List users registered with the controller.
[ "List", "users", "registered", "with", "the", "controller", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/users/users.go#L11-L24
20,906
deis/deis
client/parser/apps.go
Apps
func Apps(argv []string) error { usage := ` Valid commands for apps: apps:create create a new application apps:list list accessible applications apps:info view info about an application apps:open open the application in a browser apps:logs view aggregated application logs ap...
go
func Apps(argv []string) error { usage := ` Valid commands for apps: apps:create create a new application apps:list list accessible applications apps:info view info about an application apps:open open the application in a browser apps:logs view aggregated application logs ap...
[ "func", "Apps", "(", "argv", "[", "]", "string", ")", "error", "{", "usage", ":=", "`\nValid commands for apps:\n\napps:create create a new application\napps:list list accessible applications\napps:info view info about an application\napps:open open the appl...
// Apps routes app commands to their specific function.
[ "Apps", "routes", "app", "commands", "to", "their", "specific", "function", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/parser/apps.go#L12-L58
20,907
deis/deis
client/controller/client/http.go
CreateHTTPClient
func CreateHTTPClient(sslVerify bool) *http.Client { tr := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: !sslVerify}, DisableKeepAlives: true, } return &http.Client{Transport: tr} }
go
func CreateHTTPClient(sslVerify bool) *http.Client { tr := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: !sslVerify}, DisableKeepAlives: true, } return &http.Client{Transport: tr} }
[ "func", "CreateHTTPClient", "(", "sslVerify", "bool", ")", "*", "http", ".", "Client", "{", "tr", ":=", "&", "http", ".", "Transport", "{", "TLSClientConfig", ":", "&", "tls", ".", "Config", "{", "InsecureSkipVerify", ":", "!", "sslVerify", "}", ",", "Di...
// CreateHTTPClient creates a HTTP Client with proper SSL options.
[ "CreateHTTPClient", "creates", "a", "HTTP", "Client", "with", "proper", "SSL", "options", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/client/http.go#L20-L26
20,908
deis/deis
client/controller/client/http.go
Request
func (c Client) Request(method string, path string, body []byte) (*http.Response, error) { url := c.ControllerURL if strings.Contains(path, "?") { parts := strings.Split(path, "?") url.Path = parts[0] url.RawQuery = parts[1] } else { url.Path = path } req, err := http.NewRequest(method, url.String(), byt...
go
func (c Client) Request(method string, path string, body []byte) (*http.Response, error) { url := c.ControllerURL if strings.Contains(path, "?") { parts := strings.Split(path, "?") url.Path = parts[0] url.RawQuery = parts[1] } else { url.Path = path } req, err := http.NewRequest(method, url.String(), byt...
[ "func", "(", "c", "Client", ")", "Request", "(", "method", "string", ",", "path", "string", ",", "body", "[", "]", "byte", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "url", ":=", "c", ".", "ControllerURL", "\n\n", "if", "string...
// Request makes a HTTP request on the controller.
[ "Request", "makes", "a", "HTTP", "request", "on", "the", "controller", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/client/http.go#L29-L67
20,909
deis/deis
client/controller/client/http.go
BasicRequest
func (c Client) BasicRequest(method string, path string, body []byte) (string, error) { res, err := c.Request(method, path, body) if err != nil { return "", err } defer res.Body.Close() resBody, err := ioutil.ReadAll(res.Body) if err != nil { return "", err } return string(resBody), checkForErrors(res, s...
go
func (c Client) BasicRequest(method string, path string, body []byte) (string, error) { res, err := c.Request(method, path, body) if err != nil { return "", err } defer res.Body.Close() resBody, err := ioutil.ReadAll(res.Body) if err != nil { return "", err } return string(resBody), checkForErrors(res, s...
[ "func", "(", "c", "Client", ")", "BasicRequest", "(", "method", "string", ",", "path", "string", ",", "body", "[", "]", "byte", ")", "(", "string", ",", "error", ")", "{", "res", ",", "err", ":=", "c", ".", "Request", "(", "method", ",", "path", ...
// BasicRequest makes a simple http request on the controller.
[ "BasicRequest", "makes", "a", "simple", "http", "request", "on", "the", "controller", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/client/http.go#L92-L106
20,910
deis/deis
logger/drain/factory.go
NewDrain
func NewDrain(drainURL string) (LogDrain, error) { if drainURL == "" { // nil means no drain-- which is valid return nil, nil } // Any of these three can use the same drain implementation if strings.HasPrefix(drainURL, "udp://") || strings.HasPrefix(drainURL, "syslog://") || strings.HasPrefix(drainURL, "tcp://"...
go
func NewDrain(drainURL string) (LogDrain, error) { if drainURL == "" { // nil means no drain-- which is valid return nil, nil } // Any of these three can use the same drain implementation if strings.HasPrefix(drainURL, "udp://") || strings.HasPrefix(drainURL, "syslog://") || strings.HasPrefix(drainURL, "tcp://"...
[ "func", "NewDrain", "(", "drainURL", "string", ")", "(", "LogDrain", ",", "error", ")", "{", "if", "drainURL", "==", "\"", "\"", "{", "// nil means no drain-- which is valid", "return", "nil", ",", "nil", "\n", "}", "\n", "// Any of these three can use the same dr...
// NewDrain returns a pointer to an appropriate implementation of the LogDrain interface, as // determined by the drainURL it is passed.
[ "NewDrain", "returns", "a", "pointer", "to", "an", "appropriate", "implementation", "of", "the", "LogDrain", "interface", "as", "determined", "by", "the", "drainURL", "it", "is", "passed", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/logger/drain/factory.go#L12-L27
20,911
deis/deis
logger/configurer/configurer.go
NewConfigurer
func NewConfigurer(etcdHost string, etcdPort int, etcdPath string, configInterval int, syslogishServer *syslogish.Server) (*Configurer, error) { etcdClient := etcd.NewClient([]string{fmt.Sprintf("http://%s:%d", etcdHost, etcdPort)}) ticker := time.NewTicker(time.Duration(configInterval) * time.Second) configurer :=...
go
func NewConfigurer(etcdHost string, etcdPort int, etcdPath string, configInterval int, syslogishServer *syslogish.Server) (*Configurer, error) { etcdClient := etcd.NewClient([]string{fmt.Sprintf("http://%s:%d", etcdHost, etcdPort)}) ticker := time.NewTicker(time.Duration(configInterval) * time.Second) configurer :=...
[ "func", "NewConfigurer", "(", "etcdHost", "string", ",", "etcdPort", "int", ",", "etcdPath", "string", ",", "configInterval", "int", ",", "syslogishServer", "*", "syslogish", ".", "Server", ")", "(", "*", "Configurer", ",", "error", ")", "{", "etcdClient", "...
// NewConfigurer returns a pointer to a new Configurer instance.
[ "NewConfigurer", "returns", "a", "pointer", "to", "a", "new", "Configurer", "instance", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/logger/configurer/configurer.go#L30-L53
20,912
deis/deis
logger/configurer/configurer.go
Start
func (c *Configurer) Start() { // Should only ever be called once if !c.running { c.running = true go c.configure() log.Println("configurer running") } }
go
func (c *Configurer) Start() { // Should only ever be called once if !c.running { c.running = true go c.configure() log.Println("configurer running") } }
[ "func", "(", "c", "*", "Configurer", ")", "Start", "(", ")", "{", "// Should only ever be called once", "if", "!", "c", ".", "running", "{", "c", ".", "running", "=", "true", "\n", "go", "c", ".", "configure", "(", ")", "\n", "log", ".", "Println", "...
// Start begins the configurer's main loop.
[ "Start", "begins", "the", "configurer", "s", "main", "loop", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/logger/configurer/configurer.go#L56-L63
20,913
deis/deis
client/parser/domains.go
Domains
func Domains(argv []string) error { usage := ` Valid commands for domains: domains:add bind a domain to an application domains:list list domains bound to an application domains:remove unbind a domain from an application Use 'deis help [command]' to learn more. ` switch argv[0] { case "dom...
go
func Domains(argv []string) error { usage := ` Valid commands for domains: domains:add bind a domain to an application domains:list list domains bound to an application domains:remove unbind a domain from an application Use 'deis help [command]' to learn more. ` switch argv[0] { case "dom...
[ "func", "Domains", "(", "argv", "[", "]", "string", ")", "error", "{", "usage", ":=", "`\nValid commands for domains:\n\ndomains:add bind a domain to an application\ndomains:list list domains bound to an application\ndomains:remove unbind a domain from an applicatio...
// Domains routes domain commands to their specific function.
[ "Domains", "routes", "domain", "commands", "to", "their", "specific", "function", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/parser/domains.go#L9-L39
20,914
deis/deis
client/controller/client/client.go
New
func New() (*Client, error) { filename := locateSettingsFile() if _, err := os.Stat(filename); err != nil { if os.IsNotExist(err) { return nil, errors.New("Not logged in. Use 'deis login' or 'deis register' to get started.") } return nil, err } contents, err := ioutil.ReadFile(filename) if err != nil {...
go
func New() (*Client, error) { filename := locateSettingsFile() if _, err := os.Stat(filename); err != nil { if os.IsNotExist(err) { return nil, errors.New("Not logged in. Use 'deis login' or 'deis register' to get started.") } return nil, err } contents, err := ioutil.ReadFile(filename) if err != nil {...
[ "func", "New", "(", ")", "(", "*", "Client", ",", "error", ")", "{", "filename", ":=", "locateSettingsFile", "(", ")", "\n\n", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "filename", ")", ";", "err", "!=", "nil", "{", "if", "os", ".", ...
// New creates a new client from a settings file.
[ "New", "creates", "a", "new", "client", "from", "a", "settings", "file", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/client/client.go#L47-L80
20,915
deis/deis
client/controller/client/client.go
Save
func (c Client) Save() error { settings := settingsFile{Username: c.Username, SslVerify: c.SSLVerify, Controller: c.ControllerURL.String(), Token: c.Token, Limit: c.ResponseLimit} if settings.Limit <= 0 { settings.Limit = DefaultResponseLimit } settingsContents, err := json.Marshal(settings) if err != nil {...
go
func (c Client) Save() error { settings := settingsFile{Username: c.Username, SslVerify: c.SSLVerify, Controller: c.ControllerURL.String(), Token: c.Token, Limit: c.ResponseLimit} if settings.Limit <= 0 { settings.Limit = DefaultResponseLimit } settingsContents, err := json.Marshal(settings) if err != nil {...
[ "func", "(", "c", "Client", ")", "Save", "(", ")", "error", "{", "settings", ":=", "settingsFile", "{", "Username", ":", "c", ".", "Username", ",", "SslVerify", ":", "c", ".", "SSLVerify", ",", "Controller", ":", "c", ".", "ControllerURL", ".", "String...
// Save settings to a file
[ "Save", "settings", "to", "a", "file" ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/client/client.go#L83-L102
20,916
deis/deis
client/controller/client/client.go
Delete
func Delete() error { filename := locateSettingsFile() if _, err := os.Stat(filename); err != nil { if os.IsNotExist(err) { return nil } return err } if err := os.Remove(filename); err != nil { return err } return nil }
go
func Delete() error { filename := locateSettingsFile() if _, err := os.Stat(filename); err != nil { if os.IsNotExist(err) { return nil } return err } if err := os.Remove(filename); err != nil { return err } return nil }
[ "func", "Delete", "(", ")", "error", "{", "filename", ":=", "locateSettingsFile", "(", ")", "\n\n", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "filename", ")", ";", "err", "!=", "nil", "{", "if", "os", ".", "IsNotExist", "(", "err", ")", ...
// Delete user's settings file.
[ "Delete", "user", "s", "settings", "file", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/client/client.go#L105-L121
20,917
deis/deis
client/controller/models/certs/certs.go
New
func New(c *client.Client, cert string, key string, commonName string) (api.Cert, error) { req := api.CertCreateRequest{Certificate: cert, Key: key, Name: commonName} reqBody, err := json.Marshal(req) if err != nil { return api.Cert{}, err } resBody, err := c.BasicRequest("POST", "/v1/certs/", reqBody) if er...
go
func New(c *client.Client, cert string, key string, commonName string) (api.Cert, error) { req := api.CertCreateRequest{Certificate: cert, Key: key, Name: commonName} reqBody, err := json.Marshal(req) if err != nil { return api.Cert{}, err } resBody, err := c.BasicRequest("POST", "/v1/certs/", reqBody) if er...
[ "func", "New", "(", "c", "*", "client", ".", "Client", ",", "cert", "string", ",", "key", "string", ",", "commonName", "string", ")", "(", "api", ".", "Cert", ",", "error", ")", "{", "req", ":=", "api", ".", "CertCreateRequest", "{", "Certificate", "...
// New creates a new cert.
[ "New", "creates", "a", "new", "cert", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/certs/certs.go#L28-L48
20,918
deis/deis
client/controller/models/certs/certs.go
Delete
func Delete(c *client.Client, commonName string) error { u := fmt.Sprintf("/v1/certs/%s", commonName) _, err := c.BasicRequest("DELETE", u, nil) return err }
go
func Delete(c *client.Client, commonName string) error { u := fmt.Sprintf("/v1/certs/%s", commonName) _, err := c.BasicRequest("DELETE", u, nil) return err }
[ "func", "Delete", "(", "c", "*", "client", ".", "Client", ",", "commonName", "string", ")", "error", "{", "u", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "commonName", ")", "\n\n", "_", ",", "err", ":=", "c", ".", "BasicRequest", "(", "\"",...
// Delete removes a cert.
[ "Delete", "removes", "a", "cert", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/certs/certs.go#L51-L56
20,919
deis/deis
client/cmd/domains.go
DomainsList
func DomainsList(appID string, results int) error { c, appID, err := load(appID) if err != nil { return err } if results == defaultLimit { results = c.ResponseLimit } domains, count, err := domains.List(c, appID, results) if err != nil { return err } fmt.Printf("=== %s Domains%s", appID, limitCount(...
go
func DomainsList(appID string, results int) error { c, appID, err := load(appID) if err != nil { return err } if results == defaultLimit { results = c.ResponseLimit } domains, count, err := domains.List(c, appID, results) if err != nil { return err } fmt.Printf("=== %s Domains%s", appID, limitCount(...
[ "func", "DomainsList", "(", "appID", "string", ",", "results", "int", ")", "error", "{", "c", ",", "appID", ",", "err", ":=", "load", "(", "appID", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "results", "==...
// DomainsList lists domains registered with an app.
[ "DomainsList", "lists", "domains", "registered", "with", "an", "app", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/domains.go#L11-L36
20,920
deis/deis
client/cmd/domains.go
DomainsAdd
func DomainsAdd(appID, domain string) error { c, appID, err := load(appID) if err != nil { return err } fmt.Printf("Adding %s to %s... ", domain, appID) quit := progress() _, err = domains.New(c, appID, domain) quit <- true <-quit if err != nil { return err } fmt.Println("done") return nil }
go
func DomainsAdd(appID, domain string) error { c, appID, err := load(appID) if err != nil { return err } fmt.Printf("Adding %s to %s... ", domain, appID) quit := progress() _, err = domains.New(c, appID, domain) quit <- true <-quit if err != nil { return err } fmt.Println("done") return nil }
[ "func", "DomainsAdd", "(", "appID", ",", "domain", "string", ")", "error", "{", "c", ",", "appID", ",", "err", ":=", "load", "(", "appID", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "fmt", ".", "Printf", "(", ...
// DomainsAdd adds a domain to an app.
[ "DomainsAdd", "adds", "a", "domain", "to", "an", "app", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/domains.go#L39-L59
20,921
deis/deis
client/cmd/domains.go
DomainsRemove
func DomainsRemove(appID, domain string) error { c, appID, err := load(appID) if err != nil { return err } fmt.Printf("Removing %s from %s... ", domain, appID) quit := progress() err = domains.Delete(c, appID, domain) quit <- true <-quit if err != nil { return err } fmt.Println("done") return nil }
go
func DomainsRemove(appID, domain string) error { c, appID, err := load(appID) if err != nil { return err } fmt.Printf("Removing %s from %s... ", domain, appID) quit := progress() err = domains.Delete(c, appID, domain) quit <- true <-quit if err != nil { return err } fmt.Println("done") return nil }
[ "func", "DomainsRemove", "(", "appID", ",", "domain", "string", ")", "error", "{", "c", ",", "appID", ",", "err", ":=", "load", "(", "appID", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "fmt", ".", "Printf", "(",...
// DomainsRemove removes a domain registered with an app.
[ "DomainsRemove", "removes", "a", "domain", "registered", "with", "an", "app", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/domains.go#L62-L82
20,922
deis/deis
client/parser/auth.go
Auth
func Auth(argv []string) error { usage := ` Valid commands for auth: auth:register register a new user auth:login authenticate against a controller auth:logout clear the current user session auth:passwd change the password for the current user auth:whoami display ...
go
func Auth(argv []string) error { usage := ` Valid commands for auth: auth:register register a new user auth:login authenticate against a controller auth:logout clear the current user session auth:passwd change the password for the current user auth:whoami display ...
[ "func", "Auth", "(", "argv", "[", "]", "string", ")", "error", "{", "usage", ":=", "`\nValid commands for auth:\n\nauth:register register a new user\nauth:login authenticate against a controller\nauth:logout clear the current user session\nauth:passwd ...
// Auth routes auth commands to the specific function.
[ "Auth", "routes", "auth", "commands", "to", "the", "specific", "function", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/parser/auth.go#L11-L48
20,923
deis/deis
client/controller/models/builds/builds.go
New
func New(c *client.Client, appID string, image string, procfile map[string]string) (api.Build, error) { u := fmt.Sprintf("/v1/apps/%s/builds/", appID) req := api.CreateBuildRequest{Image: image, Procfile: procfile} body, err := json.Marshal(req) if err != nil { return api.Build{}, err } resBody, err := c....
go
func New(c *client.Client, appID string, image string, procfile map[string]string) (api.Build, error) { u := fmt.Sprintf("/v1/apps/%s/builds/", appID) req := api.CreateBuildRequest{Image: image, Procfile: procfile} body, err := json.Marshal(req) if err != nil { return api.Build{}, err } resBody, err := c....
[ "func", "New", "(", "c", "*", "client", ".", "Client", ",", "appID", "string", ",", "image", "string", ",", "procfile", "map", "[", "string", "]", "string", ")", "(", "api", ".", "Build", ",", "error", ")", "{", "u", ":=", "fmt", ".", "Sprintf", ...
// New creates a build for an app.
[ "New", "creates", "a", "build", "for", "an", "app", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/builds/builds.go#L29-L54
20,924
deis/deis
builder/utils.go
YamlToJSON
func YamlToJSON(bytes []byte) (string, error) { var anomaly map[string]string if err := yaml.Unmarshal(bytes, &anomaly); err != nil { return "", err } retVal, err := json.Marshal(&anomaly) if err != nil { return "", err } return string(retVal), nil }
go
func YamlToJSON(bytes []byte) (string, error) { var anomaly map[string]string if err := yaml.Unmarshal(bytes, &anomaly); err != nil { return "", err } retVal, err := json.Marshal(&anomaly) if err != nil { return "", err } return string(retVal), nil }
[ "func", "YamlToJSON", "(", "bytes", "[", "]", "byte", ")", "(", "string", ",", "error", ")", "{", "var", "anomaly", "map", "[", "string", "]", "string", "\n\n", "if", "err", ":=", "yaml", ".", "Unmarshal", "(", "bytes", ",", "&", "anomaly", ")", ";...
// YamlToJSON takes an input yaml string, parses it and returns a string formatted as json.
[ "YamlToJSON", "takes", "an", "input", "yaml", "string", "parses", "it", "and", "returns", "a", "string", "formatted", "as", "json", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/builder/utils.go#L11-L25
20,925
deis/deis
builder/utils.go
ParseConfig
func ParseConfig(body []byte) (*Config, error) { var config Config err := json.Unmarshal(body, &config) return &config, err }
go
func ParseConfig(body []byte) (*Config, error) { var config Config err := json.Unmarshal(body, &config) return &config, err }
[ "func", "ParseConfig", "(", "body", "[", "]", "byte", ")", "(", "*", "Config", ",", "error", ")", "{", "var", "config", "Config", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "body", ",", "&", "config", ")", "\n", "return", "&", "config", ",",...
// ParseConfig takes a response body from the controller and returns a Config object.
[ "ParseConfig", "takes", "a", "response", "body", "from", "the", "controller", "and", "returns", "a", "Config", "object", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/builder/utils.go#L28-L32
20,926
deis/deis
builder/utils.go
ParseDomain
func ParseDomain(bytes []byte) (string, error) { var hook BuildHookResponse if err := json.Unmarshal(bytes, &hook); err != nil { return "", err } if hook.Domains == nil { return "", fmt.Errorf("invalid application domain") } if len(hook.Domains) < 1 { return "", fmt.Errorf("invalid application domain") }...
go
func ParseDomain(bytes []byte) (string, error) { var hook BuildHookResponse if err := json.Unmarshal(bytes, &hook); err != nil { return "", err } if hook.Domains == nil { return "", fmt.Errorf("invalid application domain") } if len(hook.Domains) < 1 { return "", fmt.Errorf("invalid application domain") }...
[ "func", "ParseDomain", "(", "bytes", "[", "]", "byte", ")", "(", "string", ",", "error", ")", "{", "var", "hook", "BuildHookResponse", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "bytes", ",", "&", "hook", ")", ";", "err", "!=", "nil", ...
// ParseDomain returns the domain field from the bytes of a build hook response.
[ "ParseDomain", "returns", "the", "domain", "field", "from", "the", "bytes", "of", "a", "build", "hook", "response", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/builder/utils.go#L35-L50
20,927
deis/deis
builder/utils.go
ParseReleaseVersion
func ParseReleaseVersion(bytes []byte) (int, error) { var hook BuildHookResponse if err := json.Unmarshal(bytes, &hook); err != nil { return 0, fmt.Errorf("invalid application json configuration") } if hook.Release == nil { return 0, fmt.Errorf("invalid application version") } return hook.Release["version"]...
go
func ParseReleaseVersion(bytes []byte) (int, error) { var hook BuildHookResponse if err := json.Unmarshal(bytes, &hook); err != nil { return 0, fmt.Errorf("invalid application json configuration") } if hook.Release == nil { return 0, fmt.Errorf("invalid application version") } return hook.Release["version"]...
[ "func", "ParseReleaseVersion", "(", "bytes", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "var", "hook", "BuildHookResponse", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "bytes", ",", "&", "hook", ")", ";", "err", "!=", "nil...
// ParseReleaseVersion returns the version field from the bytes of a build hook response.
[ "ParseReleaseVersion", "returns", "the", "version", "field", "from", "the", "bytes", "of", "a", "build", "hook", "response", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/builder/utils.go#L53-L64
20,928
deis/deis
builder/utils.go
GetDefaultType
func GetDefaultType(bytes []byte) (string, error) { type YamlTypeMap struct { DefaultProcessTypes ProcessType `yaml:"default_process_types"` } var p YamlTypeMap if err := yaml.Unmarshal(bytes, &p); err != nil { return "", err } retVal, err := json.Marshal(&p.DefaultProcessTypes) if err != nil { return ...
go
func GetDefaultType(bytes []byte) (string, error) { type YamlTypeMap struct { DefaultProcessTypes ProcessType `yaml:"default_process_types"` } var p YamlTypeMap if err := yaml.Unmarshal(bytes, &p); err != nil { return "", err } retVal, err := json.Marshal(&p.DefaultProcessTypes) if err != nil { return ...
[ "func", "GetDefaultType", "(", "bytes", "[", "]", "byte", ")", "(", "string", ",", "error", ")", "{", "type", "YamlTypeMap", "struct", "{", "DefaultProcessTypes", "ProcessType", "`yaml:\"default_process_types\"`", "\n", "}", "\n\n", "var", "p", "YamlTypeMap", "\...
// GetDefaultType returns the default process types given a YAML byte array.
[ "GetDefaultType", "returns", "the", "default", "process", "types", "given", "a", "YAML", "byte", "array", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/builder/utils.go#L67-L89
20,929
deis/deis
client/parser/git.go
Git
func Git(argv []string) error { usage := ` Valid commands for git: git:remote Adds git remote of application to repository Use 'deis help [command]' to learn more. ` switch argv[0] { case "git:remote": return gitRemote(argv) case "git": fmt.Print(usage) return nil default: PrintUsage() return...
go
func Git(argv []string) error { usage := ` Valid commands for git: git:remote Adds git remote of application to repository Use 'deis help [command]' to learn more. ` switch argv[0] { case "git:remote": return gitRemote(argv) case "git": fmt.Print(usage) return nil default: PrintUsage() return...
[ "func", "Git", "(", "argv", "[", "]", "string", ")", "error", "{", "usage", ":=", "`\nValid commands for git:\n\ngit:remote Adds git remote of application to repository\n\nUse 'deis help [command]' to learn more.\n`", "\n\n", "switch", "argv", "[", "0", "]", "{", "ca...
// Git routes git commands to their specific function.
[ "Git", "routes", "git", "commands", "to", "their", "specific", "function", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/parser/git.go#L11-L30
20,930
deis/deis
builder/sshd/sshd.go
compareKeys
func compareKeys(a, b ssh.PublicKey) bool { if a.Type() != b.Type() { return false } // The best way to compare just the key seems to be to marshal both and // then compare the output byte sequence. return subtle.ConstantTimeCompare(a.Marshal(), b.Marshal()) == 1 }
go
func compareKeys(a, b ssh.PublicKey) bool { if a.Type() != b.Type() { return false } // The best way to compare just the key seems to be to marshal both and // then compare the output byte sequence. return subtle.ConstantTimeCompare(a.Marshal(), b.Marshal()) == 1 }
[ "func", "compareKeys", "(", "a", ",", "b", "ssh", ".", "PublicKey", ")", "bool", "{", "if", "a", ".", "Type", "(", ")", "!=", "b", ".", "Type", "(", ")", "{", "return", "false", "\n", "}", "\n", "// The best way to compare just the key seems to be to marsh...
// compareKeys compares to key files and returns true of they match.
[ "compareKeys", "compares", "to", "key", "files", "and", "returns", "true", "of", "they", "match", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/builder/sshd/sshd.go#L145-L152
20,931
deis/deis
builder/sshd/sshd.go
Fingerprint
func Fingerprint(key ssh.PublicKey) string { hash := md5.Sum(key.Marshal()) buf := make([]byte, hex.EncodedLen(len(hash))) hex.Encode(buf, hash[:]) // We need this in colon notation: fp := make([]byte, len(buf)+15) i, j := 0, 0 for ; i < len(buf); i++ { if i > 0 && i%2 == 0 { fp[j] = ':' j++ } fp[j]...
go
func Fingerprint(key ssh.PublicKey) string { hash := md5.Sum(key.Marshal()) buf := make([]byte, hex.EncodedLen(len(hash))) hex.Encode(buf, hash[:]) // We need this in colon notation: fp := make([]byte, len(buf)+15) i, j := 0, 0 for ; i < len(buf); i++ { if i > 0 && i%2 == 0 { fp[j] = ':' j++ } fp[j]...
[ "func", "Fingerprint", "(", "key", "ssh", ".", "PublicKey", ")", "string", "{", "hash", ":=", "md5", ".", "Sum", "(", "key", ".", "Marshal", "(", ")", ")", "\n", "buf", ":=", "make", "(", "[", "]", "byte", ",", "hex", ".", "EncodedLen", "(", "len...
// Fingerprint generates a colon-separated fingerprint string from a public key.
[ "Fingerprint", "generates", "a", "colon", "-", "separated", "fingerprint", "string", "from", "a", "public", "key", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/builder/sshd/sshd.go#L210-L228
20,932
deis/deis
client/cmd/config.go
ConfigList
func ConfigList(appID string, oneLine bool) error { c, appID, err := load(appID) if err != nil { return err } config, err := config.List(c, appID) if err != nil { return err } var keys []string for k := range config.Values { keys = append(keys, k) } sort.Strings(keys) if oneLine { for _, key := ...
go
func ConfigList(appID string, oneLine bool) error { c, appID, err := load(appID) if err != nil { return err } config, err := config.List(c, appID) if err != nil { return err } var keys []string for k := range config.Values { keys = append(keys, k) } sort.Strings(keys) if oneLine { for _, key := ...
[ "func", "ConfigList", "(", "appID", "string", ",", "oneLine", "bool", ")", "error", "{", "c", ",", "appID", ",", "err", ":=", "load", "(", "appID", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "config", ",", "err"...
// ConfigList lists an app's config.
[ "ConfigList", "lists", "an", "app", "s", "config", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/config.go#L19-L57
20,933
deis/deis
client/cmd/config.go
ConfigSet
func ConfigSet(appID string, configVars []string) error { c, appID, err := load(appID) if err != nil { return err } configMap := parseConfig(configVars) value, ok := configMap["SSH_KEY"] if ok { sshKey := value.(string) if _, err := os.Stat(value.(string)); err == nil { contents, err := ioutil.ReadF...
go
func ConfigSet(appID string, configVars []string) error { c, appID, err := load(appID) if err != nil { return err } configMap := parseConfig(configVars) value, ok := configMap["SSH_KEY"] if ok { sshKey := value.(string) if _, err := os.Stat(value.(string)); err == nil { contents, err := ioutil.ReadF...
[ "func", "ConfigSet", "(", "appID", "string", ",", "configVars", "[", "]", "string", ")", "error", "{", "c", ",", "appID", ",", "err", ":=", "load", "(", "appID", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "confi...
// ConfigSet sets an app's config variables.
[ "ConfigSet", "sets", "an", "app", "s", "config", "variables", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/config.go#L60-L113
20,934
deis/deis
client/cmd/config.go
ConfigUnset
func ConfigUnset(appID string, configVars []string) error { c, appID, err := load(appID) if err != nil { return err } fmt.Print("Removing config... ") quit := progress() configObj := api.Config{} valuesMap := make(map[string]interface{}) for _, configVar := range configVars { valuesMap[configVar] = ni...
go
func ConfigUnset(appID string, configVars []string) error { c, appID, err := load(appID) if err != nil { return err } fmt.Print("Removing config... ") quit := progress() configObj := api.Config{} valuesMap := make(map[string]interface{}) for _, configVar := range configVars { valuesMap[configVar] = ni...
[ "func", "ConfigUnset", "(", "appID", "string", ",", "configVars", "[", "]", "string", ")", "error", "{", "c", ",", "appID", ",", "err", ":=", "load", "(", "appID", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "fmt...
// ConfigUnset removes a config variable from an app.
[ "ConfigUnset", "removes", "a", "config", "variable", "from", "an", "app", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/config.go#L116-L149
20,935
deis/deis
client/cmd/config.go
ConfigPull
func ConfigPull(appID string, interactive bool, overwrite bool) error { filename := ".env" if !overwrite { if _, err := os.Stat(filename); err == nil { return fmt.Errorf("%s already exists, pass -o to overwrite", filename) } } c, appID, err := load(appID) if err != nil { return err } configVars, err...
go
func ConfigPull(appID string, interactive bool, overwrite bool) error { filename := ".env" if !overwrite { if _, err := os.Stat(filename); err == nil { return fmt.Errorf("%s already exists, pass -o to overwrite", filename) } } c, appID, err := load(appID) if err != nil { return err } configVars, err...
[ "func", "ConfigPull", "(", "appID", "string", ",", "interactive", "bool", ",", "overwrite", "bool", ")", "error", "{", "filename", ":=", "\"", "\"", "\n\n", "if", "!", "overwrite", "{", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "filename", ...
// ConfigPull pulls an app's config to a file.
[ "ConfigPull", "pulls", "an", "app", "s", "config", "to", "a", "file", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/config.go#L152-L202
20,936
deis/deis
client/cmd/config.go
ConfigPush
func ConfigPush(appID string, fileName string) error { contents, err := ioutil.ReadFile(fileName) if err != nil { return err } config := strings.Split(string(contents), "\n") return ConfigSet(appID, config[:len(config)-1]) }
go
func ConfigPush(appID string, fileName string) error { contents, err := ioutil.ReadFile(fileName) if err != nil { return err } config := strings.Split(string(contents), "\n") return ConfigSet(appID, config[:len(config)-1]) }
[ "func", "ConfigPush", "(", "appID", "string", ",", "fileName", "string", ")", "error", "{", "contents", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "fileName", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "confi...
// ConfigPush pushes an app's config from a file.
[ "ConfigPush", "pushes", "an", "app", "s", "config", "from", "a", "file", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/config.go#L205-L214
20,937
deis/deis
deisctl/backend/fleet/stop.go
Stop
func (c *FleetClient) Stop(targets []string, wg *sync.WaitGroup, out, ew io.Writer) { // expand @* targets expandedTargets, err := c.expandTargets(targets) if err != nil { fmt.Fprintln(ew, err.Error()) return } for _, target := range expandedTargets { wg.Add(1) go doStop(c, target, wg, out, ew) } return...
go
func (c *FleetClient) Stop(targets []string, wg *sync.WaitGroup, out, ew io.Writer) { // expand @* targets expandedTargets, err := c.expandTargets(targets) if err != nil { fmt.Fprintln(ew, err.Error()) return } for _, target := range expandedTargets { wg.Add(1) go doStop(c, target, wg, out, ew) } return...
[ "func", "(", "c", "*", "FleetClient", ")", "Stop", "(", "targets", "[", "]", "string", ",", "wg", "*", "sync", ".", "WaitGroup", ",", "out", ",", "ew", "io", ".", "Writer", ")", "{", "// expand @* targets", "expandedTargets", ",", "err", ":=", "c", "...
// Stop units and wait for their desiredState
[ "Stop", "units", "and", "wait", "for", "their", "desiredState" ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/stop.go#L16-L29
20,938
deis/deis
builder/etcd/etcd.go
genSSHKeys
func genSSHKeys(c cookoo.Context) error { // Generate a new key out, err := exec.Command("ssh-keygen", "-A").CombinedOutput() if err != nil { log.Infof(c, "ssh-keygen: %s", out) log.Errf(c, "Failed to generate SSH keys: %s", err) return err } return nil }
go
func genSSHKeys(c cookoo.Context) error { // Generate a new key out, err := exec.Command("ssh-keygen", "-A").CombinedOutput() if err != nil { log.Infof(c, "ssh-keygen: %s", out) log.Errf(c, "Failed to generate SSH keys: %s", err) return err } return nil }
[ "func", "genSSHKeys", "(", "c", "cookoo", ".", "Context", ")", "error", "{", "// Generate a new key", "out", ",", "err", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ")", ".", "CombinedOutput", "(", ")", "\n", "if", "err", "!=", "n...
// genSshKeys generates the default set of SSH host keys.
[ "genSshKeys", "generates", "the", "default", "set", "of", "SSH", "host", "keys", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/builder/etcd/etcd.go#L314-L323
20,939
deis/deis
builder/etcd/etcd.go
checkRetry
func checkRetry(c *etcd.Cluster, numReqs int, last http.Response, err error) error { if numReqs > retryCycles*len(c.Machines) { return fmt.Errorf("Tried and failed %d cluster connections: %s", retryCycles, err) } switch last.StatusCode { case 0: return nil case 500: time.Sleep(retrySleep) return nil case...
go
func checkRetry(c *etcd.Cluster, numReqs int, last http.Response, err error) error { if numReqs > retryCycles*len(c.Machines) { return fmt.Errorf("Tried and failed %d cluster connections: %s", retryCycles, err) } switch last.StatusCode { case 0: return nil case 500: time.Sleep(retrySleep) return nil case...
[ "func", "checkRetry", "(", "c", "*", "etcd", ".", "Cluster", ",", "numReqs", "int", ",", "last", "http", ".", "Response", ",", "err", "error", ")", "error", "{", "if", "numReqs", ">", "retryCycles", "*", "len", "(", "c", ".", "Machines", ")", "{", ...
// checkRetry overrides etcd.DefaultCheckRetry. // // It adds configurable number of retries and configurable timesouts.
[ "checkRetry", "overrides", "etcd", ".", "DefaultCheckRetry", ".", "It", "adds", "configurable", "number", "of", "retries", "and", "configurable", "timesouts", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/builder/etcd/etcd.go#L519-L535
20,940
deis/deis
deisctl/backend/fleet/start.go
Start
func (c *FleetClient) Start(targets []string, wg *sync.WaitGroup, out, ew io.Writer) { // expand @* targets expandedTargets, err := c.expandTargets(targets) if err != nil { io.WriteString(ew, err.Error()) return } for _, target := range expandedTargets { wg.Add(1) go doStart(c, target, wg, out, ew) } re...
go
func (c *FleetClient) Start(targets []string, wg *sync.WaitGroup, out, ew io.Writer) { // expand @* targets expandedTargets, err := c.expandTargets(targets) if err != nil { io.WriteString(ew, err.Error()) return } for _, target := range expandedTargets { wg.Add(1) go doStart(c, target, wg, out, ew) } re...
[ "func", "(", "c", "*", "FleetClient", ")", "Start", "(", "targets", "[", "]", "string", ",", "wg", "*", "sync", ".", "WaitGroup", ",", "out", ",", "ew", "io", ".", "Writer", ")", "{", "// expand @* targets", "expandedTargets", ",", "err", ":=", "c", ...
// Start units and wait for their desiredState
[ "Start", "units", "and", "wait", "for", "their", "desiredState" ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/start.go#L14-L27
20,941
deis/deis
deisctl/cmd/cmd.go
Scale
func Scale(targets []string, b backend.Backend) error { var wg sync.WaitGroup for _, target := range targets { component, num, err := splitScaleTarget(target) if err != nil { return err } // the router, registry, and store-gateway are the only component that can scale at the moment if !strings.Contains(...
go
func Scale(targets []string, b backend.Backend) error { var wg sync.WaitGroup for _, target := range targets { component, num, err := splitScaleTarget(target) if err != nil { return err } // the router, registry, and store-gateway are the only component that can scale at the moment if !strings.Contains(...
[ "func", "Scale", "(", "targets", "[", "]", "string", ",", "b", "backend", ".", "Backend", ")", "error", "{", "var", "wg", "sync", ".", "WaitGroup", "\n\n", "for", "_", ",", "target", ":=", "range", "targets", "{", "component", ",", "num", ",", "err",...
// Scale grows or shrinks the number of running components. // Currently "router", "registry" and "store-gateway" are the only types that can be scaled.
[ "Scale", "grows", "or", "shrinks", "the", "number", "of", "running", "components", ".", "Currently", "router", "registry", "and", "store", "-", "gateway", "are", "the", "only", "types", "that", "can", "be", "scaled", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/cmd/cmd.go#L56-L72
20,942
deis/deis
deisctl/cmd/cmd.go
Start
func Start(targets []string, b backend.Backend) error { // if target is platform, install all services if len(targets) == 1 { switch targets[0] { case PlatformCommand: return StartPlatform(b, false) case StatelessPlatformCommand: return StartPlatform(b, true) } } var wg sync.WaitGroup b.Start(targe...
go
func Start(targets []string, b backend.Backend) error { // if target is platform, install all services if len(targets) == 1 { switch targets[0] { case PlatformCommand: return StartPlatform(b, false) case StatelessPlatformCommand: return StartPlatform(b, true) } } var wg sync.WaitGroup b.Start(targe...
[ "func", "Start", "(", "targets", "[", "]", "string", ",", "b", "backend", ".", "Backend", ")", "error", "{", "// if target is platform, install all services", "if", "len", "(", "targets", ")", "==", "1", "{", "switch", "targets", "[", "0", "]", "{", "case"...
// Start activates the specified components.
[ "Start", "activates", "the", "specified", "components", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/cmd/cmd.go#L75-L92
20,943
deis/deis
deisctl/cmd/cmd.go
RollingRestart
func RollingRestart(target string, b backend.Backend) error { var wg sync.WaitGroup b.RollingRestart(target, &wg, Stdout, Stderr) wg.Wait() return nil }
go
func RollingRestart(target string, b backend.Backend) error { var wg sync.WaitGroup b.RollingRestart(target, &wg, Stdout, Stderr) wg.Wait() return nil }
[ "func", "RollingRestart", "(", "target", "string", ",", "b", "backend", ".", "Backend", ")", "error", "{", "var", "wg", "sync", ".", "WaitGroup", "\n\n", "b", ".", "RollingRestart", "(", "target", ",", "&", "wg", ",", "Stdout", ",", "Stderr", ")", "\n"...
// RollingRestart restart instance unit in a rolling manner
[ "RollingRestart", "restart", "instance", "unit", "in", "a", "rolling", "manner" ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/cmd/cmd.go#L95-L102
20,944
deis/deis
deisctl/cmd/cmd.go
CheckRequiredKeys
func CheckRequiredKeys(cb config.Backend) error { if err := config.CheckConfig("/deis/platform/", "domain", cb); err != nil { return fmt.Errorf(`Missing platform domain, use: deisctl config platform set domain=<your-domain>`) } if err := config.CheckConfig("/deis/platform/", "sshPrivateKey", cb); err != nil { f...
go
func CheckRequiredKeys(cb config.Backend) error { if err := config.CheckConfig("/deis/platform/", "domain", cb); err != nil { return fmt.Errorf(`Missing platform domain, use: deisctl config platform set domain=<your-domain>`) } if err := config.CheckConfig("/deis/platform/", "sshPrivateKey", cb); err != nil { f...
[ "func", "CheckRequiredKeys", "(", "cb", "config", ".", "Backend", ")", "error", "{", "if", "err", ":=", "config", ".", "CheckConfig", "(", "\"", "\"", ",", "\"", "\"", ",", "cb", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(...
// CheckRequiredKeys exist in config backend
[ "CheckRequiredKeys", "exist", "in", "config", "backend" ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/cmd/cmd.go#L105-L117
20,945
deis/deis
deisctl/cmd/cmd.go
Restart
func Restart(targets []string, b backend.Backend) error { // act as if the user called "stop" and then "start" if err := Stop(targets, b); err != nil { return err } return Start(targets, b) }
go
func Restart(targets []string, b backend.Backend) error { // act as if the user called "stop" and then "start" if err := Stop(targets, b); err != nil { return err } return Start(targets, b) }
[ "func", "Restart", "(", "targets", "[", "]", "string", ",", "b", "backend", ".", "Backend", ")", "error", "{", "// act as if the user called \"stop\" and then \"start\"", "if", "err", ":=", "Stop", "(", "targets", ",", "b", ")", ";", "err", "!=", "nil", "{",...
// Restart stops and then starts the specified components.
[ "Restart", "stops", "and", "then", "starts", "the", "specified", "components", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/cmd/cmd.go#L241-L249
20,946
deis/deis
deisctl/cmd/cmd.go
Journal
func Journal(targets []string, b backend.Backend) error { for _, target := range targets { if err := b.Journal(target); err != nil { return err } } return nil }
go
func Journal(targets []string, b backend.Backend) error { for _, target := range targets { if err := b.Journal(target); err != nil { return err } } return nil }
[ "func", "Journal", "(", "targets", "[", "]", "string", ",", "b", "backend", ".", "Backend", ")", "error", "{", "for", "_", ",", "target", ":=", "range", "targets", "{", "if", "err", ":=", "b", ".", "Journal", "(", "target", ")", ";", "err", "!=", ...
// Journal prints log output for the specified components.
[ "Journal", "prints", "log", "output", "for", "the", "specified", "components", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/cmd/cmd.go#L263-L271
20,947
deis/deis
deisctl/cmd/cmd.go
Uninstall
func Uninstall(targets []string, b backend.Backend) error { if len(targets) == 1 { switch targets[0] { case PlatformCommand: return UninstallPlatform(b, false) case StatelessPlatformCommand: return UninstallPlatform(b, true) } } var wg sync.WaitGroup // uninstall the specific target b.Destroy(targe...
go
func Uninstall(targets []string, b backend.Backend) error { if len(targets) == 1 { switch targets[0] { case PlatformCommand: return UninstallPlatform(b, false) case StatelessPlatformCommand: return UninstallPlatform(b, true) } } var wg sync.WaitGroup // uninstall the specific target b.Destroy(targe...
[ "func", "Uninstall", "(", "targets", "[", "]", "string", ",", "b", "backend", ".", "Backend", ")", "error", "{", "if", "len", "(", "targets", ")", "==", "1", "{", "switch", "targets", "[", "0", "]", "{", "case", "PlatformCommand", ":", "return", "Uni...
// Uninstall unloads the definitions of the specified components. // After Uninstall, the components will be unavailable until Install is called.
[ "Uninstall", "unloads", "the", "definitions", "of", "the", "specified", "components", ".", "After", "Uninstall", "the", "components", "will", "be", "unavailable", "until", "Install", "is", "called", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/cmd/cmd.go#L335-L352
20,948
deis/deis
deisctl/cmd/cmd.go
RefreshUnits
func RefreshUnits(unitDir, tag, rootURL string) error { unitDir = utils.ResolvePath(unitDir) decoratorDir := filepath.Join(unitDir, "decorators") // create the target dir if necessary if err := os.MkdirAll(decoratorDir, 0755); err != nil { return err } // download and save the unit files to the specified path ...
go
func RefreshUnits(unitDir, tag, rootURL string) error { unitDir = utils.ResolvePath(unitDir) decoratorDir := filepath.Join(unitDir, "decorators") // create the target dir if necessary if err := os.MkdirAll(decoratorDir, 0755); err != nil { return err } // download and save the unit files to the specified path ...
[ "func", "RefreshUnits", "(", "unitDir", ",", "tag", ",", "rootURL", "string", ")", "error", "{", "unitDir", "=", "utils", ".", "ResolvePath", "(", "unitDir", ")", "\n", "decoratorDir", ":=", "filepath", ".", "Join", "(", "unitDir", ",", "\"", "\"", ")", ...
// RefreshUnits overwrites local unit files with those requested. // Downloading from the Deis project GitHub URL by tag or SHA is the only mechanism // currently supported.
[ "RefreshUnits", "overwrites", "local", "unit", "files", "with", "those", "requested", ".", "Downloading", "from", "the", "Deis", "project", "GitHub", "URL", "by", "tag", "or", "SHA", "is", "the", "only", "mechanism", "currently", "supported", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/cmd/cmd.go#L425-L453
20,949
deis/deis
deisctl/cmd/cmd.go
SSH
func SSH(target string, cmd []string, b backend.Backend) error { if len(cmd) > 0 { return b.SSHExec(target, strings.Join(cmd, " ")) } return b.SSH(target) }
go
func SSH(target string, cmd []string, b backend.Backend) error { if len(cmd) > 0 { return b.SSHExec(target, strings.Join(cmd, " ")) } return b.SSH(target) }
[ "func", "SSH", "(", "target", "string", ",", "cmd", "[", "]", "string", ",", "b", "backend", ".", "Backend", ")", "error", "{", "if", "len", "(", "cmd", ")", ">", "0", "{", "return", "b", ".", "SSHExec", "(", "target", ",", "strings", ".", "Join"...
// SSH opens an interactive shell on a machine in the cluster
[ "SSH", "opens", "an", "interactive", "shell", "on", "a", "machine", "in", "the", "cluster" ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/cmd/cmd.go#L456-L463
20,950
deis/deis
client/parser/tags.go
Tags
func Tags(argv []string) error { usage := ` Valid commands for tags: tags:list list tags for an app tags:set set tags for an app tags:unset unset tags for an app Use 'deis help [command]' to learn more. ` switch argv[0] { case "tags:list": return tagsList(argv) case "tags:set": return ta...
go
func Tags(argv []string) error { usage := ` Valid commands for tags: tags:list list tags for an app tags:set set tags for an app tags:unset unset tags for an app Use 'deis help [command]' to learn more. ` switch argv[0] { case "tags:list": return tagsList(argv) case "tags:set": return ta...
[ "func", "Tags", "(", "argv", "[", "]", "string", ")", "error", "{", "usage", ":=", "`\nValid commands for tags:\n\ntags:list list tags for an app\ntags:set set tags for an app\ntags:unset unset tags for an app\n\nUse 'deis help [command]' to learn more.\n`", "\n\n", ...
// Tags routes tags commands to their specific function
[ "Tags", "routes", "tags", "commands", "to", "their", "specific", "function" ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/parser/tags.go#L9-L40
20,951
deis/deis
logger/storage/factory.go
NewAdapter
func NewAdapter(storeageAdapterType string) (Adapter, error) { if storeageAdapterType == "" || storeageAdapterType == "file" { adapter, err := file.NewStorageAdapter(LogRoot) if err != nil { return nil, err } return adapter, nil } match := memoryAdapterRegex.FindStringSubmatch(storeageAdapterType) if mat...
go
func NewAdapter(storeageAdapterType string) (Adapter, error) { if storeageAdapterType == "" || storeageAdapterType == "file" { adapter, err := file.NewStorageAdapter(LogRoot) if err != nil { return nil, err } return adapter, nil } match := memoryAdapterRegex.FindStringSubmatch(storeageAdapterType) if mat...
[ "func", "NewAdapter", "(", "storeageAdapterType", "string", ")", "(", "Adapter", ",", "error", ")", "{", "if", "storeageAdapterType", "==", "\"", "\"", "||", "storeageAdapterType", "==", "\"", "\"", "{", "adapter", ",", "err", ":=", "file", ".", "NewStorageA...
// NewAdapter returns a pointer to an appropriate implementation of the Adapter interface, as // determined by the storeageAdapterType string it is passed.
[ "NewAdapter", "returns", "a", "pointer", "to", "an", "appropriate", "implementation", "of", "the", "Adapter", "interface", "as", "determined", "by", "the", "storeageAdapterType", "string", "it", "is", "passed", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/logger/storage/factory.go#L23-L48
20,952
deis/deis
builder/docker/docker.go
Start
func Start(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt) { // Allow insecure Docker registries on all private network ranges in RFC 1918 and RFC 6598. dargs := []string{ "-d", "--bip=172.19.42.1/16", "--insecure-registry", "10.0.0.0/8", "--insecure-registry", "172.16.0.0/12", "--in...
go
func Start(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt) { // Allow insecure Docker registries on all private network ranges in RFC 1918 and RFC 6598. dargs := []string{ "-d", "--bip=172.19.42.1/16", "--insecure-registry", "10.0.0.0/8", "--insecure-registry", "172.16.0.0/12", "--in...
[ "func", "Start", "(", "c", "cookoo", ".", "Context", ",", "p", "*", "cookoo", ".", "Params", ")", "(", "interface", "{", "}", ",", "cookoo", ".", "Interrupt", ")", "{", "// Allow insecure Docker registries on all private network ranges in RFC 1918 and RFC 6598.", "d...
// Start starts a Docker daemon. // // This assumes the presence of the docker client on the host. It does not use // the API.
[ "Start", "starts", "a", "Docker", "daemon", ".", "This", "assumes", "the", "presence", "of", "the", "docker", "client", "on", "the", "host", ".", "It", "does", "not", "use", "the", "API", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/builder/docker/docker.go#L62-L100
20,953
deis/deis
client/parser/releases.go
Releases
func Releases(argv []string) error { usage := ` Valid commands for releases: releases:list list an application's release history releases:info print information about a specific release releases:rollback return to a previous release Use 'deis help [command]' to learn more. ` switch argv[0] { case...
go
func Releases(argv []string) error { usage := ` Valid commands for releases: releases:list list an application's release history releases:info print information about a specific release releases:rollback return to a previous release Use 'deis help [command]' to learn more. ` switch argv[0] { case...
[ "func", "Releases", "(", "argv", "[", "]", "string", ")", "error", "{", "usage", ":=", "`\nValid commands for releases:\n\nreleases:list list an application's release history\nreleases:info print information about a specific release\nreleases:rollback return to a previous re...
// Releases routes releases commands to their specific function.
[ "Releases", "routes", "releases", "commands", "to", "their", "specific", "function", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/parser/releases.go#L12-L43
20,954
deis/deis
client/pkg/git/git.go
CreateRemote
func CreateRemote(host, remote, appID string) error { cmd := exec.Command("git", "remote", "add", remote, RemoteURL(host, appID)) stderr, err := cmd.StderrPipe() if err != nil { return err } if err = cmd.Start(); err != nil { return err } output, _ := ioutil.ReadAll(stderr) fmt.Print(string(output)) if...
go
func CreateRemote(host, remote, appID string) error { cmd := exec.Command("git", "remote", "add", remote, RemoteURL(host, appID)) stderr, err := cmd.StderrPipe() if err != nil { return err } if err = cmd.Start(); err != nil { return err } output, _ := ioutil.ReadAll(stderr) fmt.Print(string(output)) if...
[ "func", "CreateRemote", "(", "host", ",", "remote", ",", "appID", "string", ")", "error", "{", "cmd", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "remote", ",", "RemoteURL", "(", "host", ",", "appID", ")", ...
// CreateRemote adds a git remote in the current directory.
[ "CreateRemote", "adds", "a", "git", "remote", "in", "the", "current", "directory", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/pkg/git/git.go#L14-L36
20,955
deis/deis
client/pkg/git/git.go
DeleteRemote
func DeleteRemote(appID string) error { name, err := remoteNameFromAppID(appID) if err != nil { return err } if _, err = exec.Command("git", "remote", "remove", name).Output(); err != nil { return err } fmt.Printf("Git remote %s removed\n", name) return nil }
go
func DeleteRemote(appID string) error { name, err := remoteNameFromAppID(appID) if err != nil { return err } if _, err = exec.Command("git", "remote", "remove", name).Output(); err != nil { return err } fmt.Printf("Git remote %s removed\n", name) return nil }
[ "func", "DeleteRemote", "(", "appID", "string", ")", "error", "{", "name", ",", "err", ":=", "remoteNameFromAppID", "(", "appID", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "_", ",", "err", "=", "exec", ".",...
// DeleteRemote removes a git remote in the current directory.
[ "DeleteRemote", "removes", "a", "git", "remote", "in", "the", "current", "directory", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/pkg/git/git.go#L39-L53
20,956
deis/deis
client/pkg/git/git.go
DetectAppName
func DetectAppName(host string) (string, error) { remote, err := findRemote(host) // Don't return an error if remote can't be found, return directory name instead. if err != nil { dir, err := os.Getwd() return strings.ToLower(path.Base(dir)), err } ss := strings.Split(remote, "/") return strings.Split(ss[le...
go
func DetectAppName(host string) (string, error) { remote, err := findRemote(host) // Don't return an error if remote can't be found, return directory name instead. if err != nil { dir, err := os.Getwd() return strings.ToLower(path.Base(dir)), err } ss := strings.Split(remote, "/") return strings.Split(ss[le...
[ "func", "DetectAppName", "(", "host", "string", ")", "(", "string", ",", "error", ")", "{", "remote", ",", "err", ":=", "findRemote", "(", "host", ")", "\n\n", "// Don't return an error if remote can't be found, return directory name instead.", "if", "err", "!=", "n...
// DetectAppName detects if there is deis remote in git.
[ "DetectAppName", "detects", "if", "there", "is", "deis", "remote", "in", "git", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/pkg/git/git.go#L74-L85
20,957
deis/deis
client/pkg/git/git.go
RemoteURL
func RemoteURL(host, appID string) string { // Strip off any trailing :port number after the host name. host = strings.Split(host, ":")[0] return fmt.Sprintf("ssh://git@%s:2222/%s.git", host, appID) }
go
func RemoteURL(host, appID string) string { // Strip off any trailing :port number after the host name. host = strings.Split(host, ":")[0] return fmt.Sprintf("ssh://git@%s:2222/%s.git", host, appID) }
[ "func", "RemoteURL", "(", "host", ",", "appID", "string", ")", "string", "{", "// Strip off any trailing :port number after the host name.", "host", "=", "strings", ".", "Split", "(", "host", ",", "\"", "\"", ")", "[", "0", "]", "\n", "return", "fmt", ".", "...
// RemoteURL returns the git URL of app.
[ "RemoteURL", "returns", "the", "git", "URL", "of", "app", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/pkg/git/git.go#L111-L115
20,958
deis/deis
client/cmd/keys.go
KeysList
func KeysList(results int) error { c, err := client.New() if err != nil { return err } if results == defaultLimit { results = c.ResponseLimit } keys, count, err := keys.List(c, results) if err != nil { return err } fmt.Printf("=== %s Keys%s", c.Username, limitCount(len(keys), count)) sort.Sort(key...
go
func KeysList(results int) error { c, err := client.New() if err != nil { return err } if results == defaultLimit { results = c.ResponseLimit } keys, count, err := keys.List(c, results) if err != nil { return err } fmt.Printf("=== %s Keys%s", c.Username, limitCount(len(keys), count)) sort.Sort(key...
[ "func", "KeysList", "(", "results", "int", ")", "error", "{", "c", ",", "err", ":=", "client", ".", "New", "(", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "results", "==", "defaultLimit", "{", "results", "...
// KeysList lists a user's keys.
[ "KeysList", "lists", "a", "user", "s", "keys", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/keys.go#L18-L43
20,959
deis/deis
client/cmd/keys.go
KeyRemove
func KeyRemove(keyID string) error { c, err := client.New() if err != nil { return err } fmt.Printf("Removing %s SSH Key...", keyID) if err = keys.Delete(c, keyID); err != nil { fmt.Println() return err } fmt.Println(" done") return nil }
go
func KeyRemove(keyID string) error { c, err := client.New() if err != nil { return err } fmt.Printf("Removing %s SSH Key...", keyID) if err = keys.Delete(c, keyID); err != nil { fmt.Println() return err } fmt.Println(" done") return nil }
[ "func", "KeyRemove", "(", "keyID", "string", ")", "error", "{", "c", ",", "err", ":=", "client", ".", "New", "(", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "fmt", ".", "Printf", "(", "\"", "\"", ",", "keyID",...
// KeyRemove removes keys.
[ "KeyRemove", "removes", "keys", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/keys.go#L46-L62
20,960
deis/deis
client/cmd/keys.go
KeyAdd
func KeyAdd(keyLocation string) error { c, err := client.New() if err != nil { return err } var key api.KeyCreateRequest if keyLocation == "" { key, err = chooseKey() } else { key, err = getKey(keyLocation) } if err != nil { return err } fmt.Printf("Uploading %s to deis...", path.Base(key.Name)) ...
go
func KeyAdd(keyLocation string) error { c, err := client.New() if err != nil { return err } var key api.KeyCreateRequest if keyLocation == "" { key, err = chooseKey() } else { key, err = getKey(keyLocation) } if err != nil { return err } fmt.Printf("Uploading %s to deis...", path.Base(key.Name)) ...
[ "func", "KeyAdd", "(", "keyLocation", "string", ")", "error", "{", "c", ",", "err", ":=", "client", ".", "New", "(", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "var", "key", "api", ".", "KeyCreateRequest", "\n\n",...
// KeyAdd adds keys.
[ "KeyAdd", "adds", "keys", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/keys.go#L65-L93
20,961
deis/deis
client/controller/models/keys/keys.go
New
func New(c *client.Client, id string, pubKey string) (api.Key, error) { req := api.KeyCreateRequest{ID: id, Public: pubKey} body, err := json.Marshal(req) resBody, err := c.BasicRequest("POST", "/v1/keys/", body) if err != nil { return api.Key{}, err } key := api.Key{} if err = json.Unmarshal([]byte(resBody...
go
func New(c *client.Client, id string, pubKey string) (api.Key, error) { req := api.KeyCreateRequest{ID: id, Public: pubKey} body, err := json.Marshal(req) resBody, err := c.BasicRequest("POST", "/v1/keys/", body) if err != nil { return api.Key{}, err } key := api.Key{} if err = json.Unmarshal([]byte(resBody...
[ "func", "New", "(", "c", "*", "client", ".", "Client", ",", "id", "string", ",", "pubKey", "string", ")", "(", "api", ".", "Key", ",", "error", ")", "{", "req", ":=", "api", ".", "KeyCreateRequest", "{", "ID", ":", "id", ",", "Public", ":", "pubK...
// New creates a new key.
[ "New", "creates", "a", "new", "key", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/keys/keys.go#L28-L44
20,962
deis/deis
pkg/time/time.go
MarshalJSON
func (t *Time) MarshalJSON() ([]byte, error) { return []byte(t.Time.Format(`"` + DeisDatetimeFormat + `"`)), nil }
go
func (t *Time) MarshalJSON() ([]byte, error) { return []byte(t.Time.Format(`"` + DeisDatetimeFormat + `"`)), nil }
[ "func", "(", "t", "*", "Time", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "[", "]", "byte", "(", "t", ".", "Time", ".", "Format", "(", "`\"`", "+", "DeisDatetimeFormat", "+", "`\"`", ")", ")", ",", "n...
// MarshalJSON implements the json.Marshaler interface. // The time is a quoted string in Deis' datetime format.
[ "MarshalJSON", "implements", "the", "json", ".", "Marshaler", "interface", ".", "The", "time", "is", "a", "quoted", "string", "in", "Deis", "datetime", "format", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/pkg/time/time.go#L19-L21
20,963
deis/deis
pkg/prettyprint/colorizer.go
DeisIfy
func DeisIfy(msg string) string { var t = struct { Msg string C map[string]string }{ Msg: msg, C: Colors, } tpl := "{{.C.Deis1}}\n{{.C.Deis2}} {{.Msg}}\n{{.C.Deis3}}\n" var buf bytes.Buffer template.Must(template.New("deis").Parse(tpl)).Execute(&buf, t) return buf.String() }
go
func DeisIfy(msg string) string { var t = struct { Msg string C map[string]string }{ Msg: msg, C: Colors, } tpl := "{{.C.Deis1}}\n{{.C.Deis2}} {{.Msg}}\n{{.C.Deis3}}\n" var buf bytes.Buffer template.Must(template.New("deis").Parse(tpl)).Execute(&buf, t) return buf.String() }
[ "func", "DeisIfy", "(", "msg", "string", ")", "string", "{", "var", "t", "=", "struct", "{", "Msg", "string", "\n", "C", "map", "[", "string", "]", "string", "\n", "}", "{", "Msg", ":", "msg", ",", "C", ":", "Colors", ",", "}", "\n", "tpl", ":=...
// DeisIfy returns a pretty-printed deis logo along with the corresponding message
[ "DeisIfy", "returns", "a", "pretty", "-", "printed", "deis", "logo", "along", "with", "the", "corresponding", "message" ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/pkg/prettyprint/colorizer.go#L63-L75
20,964
deis/deis
pkg/prettyprint/colorizer.go
NoColor
func NoColor(msg string) string { empties := make(map[string]string, len(Colors)) for k := range Colors { empties[k] = "" } return colorize(msg, empties) }
go
func NoColor(msg string) string { empties := make(map[string]string, len(Colors)) for k := range Colors { empties[k] = "" } return colorize(msg, empties) }
[ "func", "NoColor", "(", "msg", "string", ")", "string", "{", "empties", ":=", "make", "(", "map", "[", "string", "]", "string", ",", "len", "(", "Colors", ")", ")", "\n", "for", "k", ":=", "range", "Colors", "{", "empties", "[", "k", "]", "=", "\...
// NoColor strips colors from the template. // // NoColor provides support for non-color ANSI terminals. It can be used // as an alternative to Colorize when it is detected that the terminal does // not support colors.
[ "NoColor", "strips", "colors", "from", "the", "template", ".", "NoColor", "provides", "support", "for", "non", "-", "color", "ANSI", "terminals", ".", "It", "can", "be", "used", "as", "an", "alternative", "to", "Colorize", "when", "it", "is", "detected", "...
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/pkg/prettyprint/colorizer.go#L87-L93
20,965
deis/deis
pkg/prettyprint/colorizer.go
Overwritef
func Overwritef(msg string, args ...interface{}) string { return Overwrite(fmt.Sprintf(msg, args...)) }
go
func Overwritef(msg string, args ...interface{}) string { return Overwrite(fmt.Sprintf(msg, args...)) }
[ "func", "Overwritef", "(", "msg", "string", ",", "args", "...", "interface", "{", "}", ")", "string", "{", "return", "Overwrite", "(", "fmt", ".", "Sprintf", "(", "msg", ",", "args", "...", ")", ")", "\n", "}" ]
// Overwritef formats a string and then returns an overwrite line. // // See `Overwrite` for details.
[ "Overwritef", "formats", "a", "string", "and", "then", "returns", "an", "overwrite", "line", ".", "See", "Overwrite", "for", "details", "." ]
1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410
https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/pkg/prettyprint/colorizer.go#L162-L164
20,966
hashicorp/go-getter
get.go
Get
func Get(dst, src string, opts ...ClientOption) error { return (&Client{ Src: src, Dst: dst, Dir: true, Options: opts, }).Get() }
go
func Get(dst, src string, opts ...ClientOption) error { return (&Client{ Src: src, Dst: dst, Dir: true, Options: opts, }).Get() }
[ "func", "Get", "(", "dst", ",", "src", "string", ",", "opts", "...", "ClientOption", ")", "error", "{", "return", "(", "&", "Client", "{", "Src", ":", "src", ",", "Dst", ":", "dst", ",", "Dir", ":", "true", ",", "Options", ":", "opts", ",", "}", ...
// Get downloads the directory specified by src into the folder specified by // dst. If dst already exists, Get will attempt to update it. // // src is a URL, whereas dst is always just a file path to a folder. This // folder doesn't need to exist. It will be created if it doesn't exist.
[ "Get", "downloads", "the", "directory", "specified", "by", "src", "into", "the", "folder", "specified", "by", "dst", ".", "If", "dst", "already", "exists", "Get", "will", "attempt", "to", "update", "it", ".", "src", "is", "a", "URL", "whereas", "dst", "i...
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/get.go#L83-L90
20,967
hashicorp/go-getter
get.go
GetAny
func GetAny(dst, src string, opts ...ClientOption) error { return (&Client{ Src: src, Dst: dst, Mode: ClientModeAny, Options: opts, }).Get() }
go
func GetAny(dst, src string, opts ...ClientOption) error { return (&Client{ Src: src, Dst: dst, Mode: ClientModeAny, Options: opts, }).Get() }
[ "func", "GetAny", "(", "dst", ",", "src", "string", ",", "opts", "...", "ClientOption", ")", "error", "{", "return", "(", "&", "Client", "{", "Src", ":", "src", ",", "Dst", ":", "dst", ",", "Mode", ":", "ClientModeAny", ",", "Options", ":", "opts", ...
// GetAny downloads a URL into the given destination. Unlike Get or // GetFile, both directories and files are supported. // // dst must be a directory. If src is a file, it will be downloaded // into dst with the basename of the URL. If src is a directory or // archive, it will be unpacked directly into dst.
[ "GetAny", "downloads", "a", "URL", "into", "the", "given", "destination", ".", "Unlike", "Get", "or", "GetFile", "both", "directories", "and", "files", "are", "supported", ".", "dst", "must", "be", "a", "directory", ".", "If", "src", "is", "a", "file", "...
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/get.go#L98-L105
20,968
hashicorp/go-getter
get.go
getRunCommand
func getRunCommand(cmd *exec.Cmd) error { var buf bytes.Buffer cmd.Stdout = &buf cmd.Stderr = &buf err := cmd.Run() if err == nil { return nil } if exiterr, ok := err.(*exec.ExitError); ok { // The program has exited with an exit code != 0 if status, ok := exiterr.Sys().(syscall.WaitStatus); ok { return...
go
func getRunCommand(cmd *exec.Cmd) error { var buf bytes.Buffer cmd.Stdout = &buf cmd.Stderr = &buf err := cmd.Run() if err == nil { return nil } if exiterr, ok := err.(*exec.ExitError); ok { // The program has exited with an exit code != 0 if status, ok := exiterr.Sys().(syscall.WaitStatus); ok { return...
[ "func", "getRunCommand", "(", "cmd", "*", "exec", ".", "Cmd", ")", "error", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "cmd", ".", "Stdout", "=", "&", "buf", "\n", "cmd", ".", "Stderr", "=", "&", "buf", "\n", "err", ":=", "cmd", ".", "Run",...
// getRunCommand is a helper that will run a command and capture the output // in the case an error happens.
[ "getRunCommand", "is", "a", "helper", "that", "will", "run", "a", "command", "and", "capture", "the", "output", "in", "the", "case", "an", "error", "happens", "." ]
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/get.go#L120-L140
20,969
hashicorp/go-getter
client_option_progress.go
WithProgress
func WithProgress(pl ProgressTracker) func(*Client) error { return func(c *Client) error { c.ProgressListener = pl return nil } }
go
func WithProgress(pl ProgressTracker) func(*Client) error { return func(c *Client) error { c.ProgressListener = pl return nil } }
[ "func", "WithProgress", "(", "pl", "ProgressTracker", ")", "func", "(", "*", "Client", ")", "error", "{", "return", "func", "(", "c", "*", "Client", ")", "error", "{", "c", ".", "ProgressListener", "=", "pl", "\n", "return", "nil", "\n", "}", "\n", "...
// WithProgress allows for a user to track // the progress of a download. // For example by displaying a progress bar with // current download. // Not all getters have progress support yet.
[ "WithProgress", "allows", "for", "a", "user", "to", "track", "the", "progress", "of", "a", "download", ".", "For", "example", "by", "displaying", "a", "progress", "bar", "with", "current", "download", ".", "Not", "all", "getters", "have", "progress", "suppor...
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/client_option_progress.go#L12-L17
20,970
hashicorp/go-getter
get_git.go
fetchSubmodules
func (g *GitGetter) fetchSubmodules(ctx context.Context, dst, sshKeyFile string, depth int) error { args := []string{"submodule", "update", "--init", "--recursive"} if depth > 0 { args = append(args, "--depth", strconv.Itoa(depth)) } cmd := exec.CommandContext(ctx, "git", args...) cmd.Dir = dst setupGitEnv(cmd,...
go
func (g *GitGetter) fetchSubmodules(ctx context.Context, dst, sshKeyFile string, depth int) error { args := []string{"submodule", "update", "--init", "--recursive"} if depth > 0 { args = append(args, "--depth", strconv.Itoa(depth)) } cmd := exec.CommandContext(ctx, "git", args...) cmd.Dir = dst setupGitEnv(cmd,...
[ "func", "(", "g", "*", "GitGetter", ")", "fetchSubmodules", "(", "ctx", "context", ".", "Context", ",", "dst", ",", "sshKeyFile", "string", ",", "depth", "int", ")", "error", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ...
// fetchSubmodules downloads any configured submodules recursively.
[ "fetchSubmodules", "downloads", "any", "configured", "submodules", "recursively", "." ]
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/get_git.go#L216-L225
20,971
hashicorp/go-getter
get_git.go
setupGitEnv
func setupGitEnv(cmd *exec.Cmd, sshKeyFile string) { const gitSSHCommand = "GIT_SSH_COMMAND=" var sshCmd []string // If we have an existing GIT_SSH_COMMAND, we need to append our options. // We will also remove our old entry to make sure the behavior is the same // with versions of Go < 1.9. env := os.Environ() ...
go
func setupGitEnv(cmd *exec.Cmd, sshKeyFile string) { const gitSSHCommand = "GIT_SSH_COMMAND=" var sshCmd []string // If we have an existing GIT_SSH_COMMAND, we need to append our options. // We will also remove our old entry to make sure the behavior is the same // with versions of Go < 1.9. env := os.Environ() ...
[ "func", "setupGitEnv", "(", "cmd", "*", "exec", ".", "Cmd", ",", "sshKeyFile", "string", ")", "{", "const", "gitSSHCommand", "=", "\"", "\"", "\n", "var", "sshCmd", "[", "]", "string", "\n\n", "// If we have an existing GIT_SSH_COMMAND, we need to append our options...
// setupGitEnv sets up the environment for the given command. This is used to // pass configuration data to git and ssh and enables advanced cloning methods.
[ "setupGitEnv", "sets", "up", "the", "environment", "for", "the", "given", "command", ".", "This", "is", "used", "to", "pass", "configuration", "data", "to", "git", "and", "ssh", "and", "enables", "advanced", "cloning", "methods", "." ]
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/get_git.go#L229-L261
20,972
hashicorp/go-getter
get_git.go
checkGitVersion
func checkGitVersion(min string) error { want, err := version.NewVersion(min) if err != nil { return err } out, err := exec.Command("git", "version").Output() if err != nil { return err } fields := strings.Fields(string(out)) if len(fields) < 3 { return fmt.Errorf("Unexpected 'git version' output: %q", ...
go
func checkGitVersion(min string) error { want, err := version.NewVersion(min) if err != nil { return err } out, err := exec.Command("git", "version").Output() if err != nil { return err } fields := strings.Fields(string(out)) if len(fields) < 3 { return fmt.Errorf("Unexpected 'git version' output: %q", ...
[ "func", "checkGitVersion", "(", "min", "string", ")", "error", "{", "want", ",", "err", ":=", "version", ".", "NewVersion", "(", "min", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "out", ",", "err", ":=", "exec", "...
// checkGitVersion is used to check the version of git installed on the system // against a known minimum version. Returns an error if the installed version // is older than the given minimum.
[ "checkGitVersion", "is", "used", "to", "check", "the", "version", "of", "git", "installed", "on", "the", "system", "against", "a", "known", "minimum", "version", ".", "Returns", "an", "error", "if", "the", "installed", "version", "is", "older", "than", "the"...
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/get_git.go#L266-L301
20,973
hashicorp/go-getter
get_http.go
getSubdir
func (g *HttpGetter) getSubdir(ctx context.Context, dst, source, subDir string) error { // Create a temporary directory to store the full source. This has to be // a non-existent directory. td, tdcloser, err := safetemp.Dir("", "getter") if err != nil { return err } defer tdcloser.Close() var opts []ClientOpt...
go
func (g *HttpGetter) getSubdir(ctx context.Context, dst, source, subDir string) error { // Create a temporary directory to store the full source. This has to be // a non-existent directory. td, tdcloser, err := safetemp.Dir("", "getter") if err != nil { return err } defer tdcloser.Close() var opts []ClientOpt...
[ "func", "(", "g", "*", "HttpGetter", ")", "getSubdir", "(", "ctx", "context", ".", "Context", ",", "dst", ",", "source", ",", "subDir", "string", ")", "error", "{", "// Create a temporary directory to store the full source. This has to be", "// a non-existent directory....
// getSubdir downloads the source into the destination, but with // the proper subdir.
[ "getSubdir", "downloads", "the", "source", "into", "the", "destination", "but", "with", "the", "proper", "subdir", "." ]
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/get_http.go#L220-L261
20,974
hashicorp/go-getter
get_http.go
parseMeta
func (g *HttpGetter) parseMeta(r io.Reader) (string, error) { d := xml.NewDecoder(r) d.CharsetReader = charsetReader d.Strict = false var err error var t xml.Token for { t, err = d.Token() if err != nil { if err == io.EOF { err = nil } return "", err } if e, ok := t.(xml.StartElement); ok && ...
go
func (g *HttpGetter) parseMeta(r io.Reader) (string, error) { d := xml.NewDecoder(r) d.CharsetReader = charsetReader d.Strict = false var err error var t xml.Token for { t, err = d.Token() if err != nil { if err == io.EOF { err = nil } return "", err } if e, ok := t.(xml.StartElement); ok && ...
[ "func", "(", "g", "*", "HttpGetter", ")", "parseMeta", "(", "r", "io", ".", "Reader", ")", "(", "string", ",", "error", ")", "{", "d", ":=", "xml", ".", "NewDecoder", "(", "r", ")", "\n", "d", ".", "CharsetReader", "=", "charsetReader", "\n", "d", ...
// parseMeta looks for the first meta tag in the given reader that // will give us the source URL.
[ "parseMeta", "looks", "for", "the", "first", "meta", "tag", "in", "the", "given", "reader", "that", "will", "give", "us", "the", "source", "URL", "." ]
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/get_http.go#L265-L296
20,975
hashicorp/go-getter
cmd/go-getter/progress_tracking.go
TrackProgress
func (cpb *ProgressBar) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser { cpb.lock.Lock() defer cpb.lock.Unlock() newPb := pb.New64(totalSize) newPb.Set64(currentSize) ProgressBarConfig(newPb, filepath.Base(src)) if cpb.pool == nil { cpb.pool = pb.NewPool() cpb.poo...
go
func (cpb *ProgressBar) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser { cpb.lock.Lock() defer cpb.lock.Unlock() newPb := pb.New64(totalSize) newPb.Set64(currentSize) ProgressBarConfig(newPb, filepath.Base(src)) if cpb.pool == nil { cpb.pool = pb.NewPool() cpb.poo...
[ "func", "(", "cpb", "*", "ProgressBar", ")", "TrackProgress", "(", "src", "string", ",", "currentSize", ",", "totalSize", "int64", ",", "stream", "io", ".", "ReadCloser", ")", "io", ".", "ReadCloser", "{", "cpb", ".", "lock", ".", "Lock", "(", ")", "\n...
// TrackProgress instantiates a new progress bar that will // display the progress of stream until closed. // total can be 0.
[ "TrackProgress", "instantiates", "a", "new", "progress", "bar", "that", "will", "display", "the", "progress", "of", "stream", "until", "closed", ".", "total", "can", "be", "0", "." ]
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/cmd/go-getter/progress_tracking.go#L40-L70
20,976
hashicorp/go-getter
detect_ssh.go
detectSSH
func detectSSH(src string) (*url.URL, error) { matched := sshPattern.FindStringSubmatch(src) if matched == nil { return nil, nil } user := matched[1] host := matched[2] path := matched[3] qidx := strings.Index(path, "?") if qidx == -1 { qidx = len(path) } var u url.URL u.Scheme = "ssh" u.User = url.Us...
go
func detectSSH(src string) (*url.URL, error) { matched := sshPattern.FindStringSubmatch(src) if matched == nil { return nil, nil } user := matched[1] host := matched[2] path := matched[3] qidx := strings.Index(path, "?") if qidx == -1 { qidx = len(path) } var u url.URL u.Scheme = "ssh" u.User = url.Us...
[ "func", "detectSSH", "(", "src", "string", ")", "(", "*", "url", ".", "URL", ",", "error", ")", "{", "matched", ":=", "sshPattern", ".", "FindStringSubmatch", "(", "src", ")", "\n", "if", "matched", "==", "nil", "{", "return", "nil", ",", "nil", "\n"...
// detectSSH determines if the src string matches an SSH-like URL and // converts it into a net.URL compatible string. This returns nil if the // string doesn't match the SSH pattern. // // This function is tested indirectly via detect_git_test.go
[ "detectSSH", "determines", "if", "the", "src", "string", "matches", "an", "SSH", "-", "like", "URL", "and", "converts", "it", "into", "a", "net", ".", "URL", "compatible", "string", ".", "This", "returns", "nil", "if", "the", "string", "doesn", "t", "mat...
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/detect_ssh.go#L21-L49
20,977
hashicorp/go-getter
get_hg.go
GetFile
func (g *HgGetter) GetFile(dst string, u *url.URL) error { // Create a temporary directory to store the full source. This has to be // a non-existent directory. td, tdcloser, err := safetemp.Dir("", "getter") if err != nil { return err } defer tdcloser.Close() // Get the filename, and strip the filename from ...
go
func (g *HgGetter) GetFile(dst string, u *url.URL) error { // Create a temporary directory to store the full source. This has to be // a non-existent directory. td, tdcloser, err := safetemp.Dir("", "getter") if err != nil { return err } defer tdcloser.Close() // Get the filename, and strip the filename from ...
[ "func", "(", "g", "*", "HgGetter", ")", "GetFile", "(", "dst", "string", ",", "u", "*", "url", ".", "URL", ")", "error", "{", "// Create a temporary directory to store the full source. This has to be", "// a non-existent directory.", "td", ",", "tdcloser", ",", "err...
// GetFile for Hg doesn't support updating at this time. It will download // the file every time.
[ "GetFile", "for", "Hg", "doesn", "t", "support", "updating", "at", "this", "time", ".", "It", "will", "download", "the", "file", "every", "time", "." ]
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/get_hg.go#L70-L102
20,978
hashicorp/go-getter
folder_storage.go
Dir
func (s *FolderStorage) Dir(key string) (d string, e bool, err error) { d = s.dir(key) _, err = os.Stat(d) if err == nil { // Directory exists e = true return } if os.IsNotExist(err) { // Directory doesn't exist d = "" e = false err = nil return } // An error d = "" e = false return }
go
func (s *FolderStorage) Dir(key string) (d string, e bool, err error) { d = s.dir(key) _, err = os.Stat(d) if err == nil { // Directory exists e = true return } if os.IsNotExist(err) { // Directory doesn't exist d = "" e = false err = nil return } // An error d = "" e = false return }
[ "func", "(", "s", "*", "FolderStorage", ")", "Dir", "(", "key", "string", ")", "(", "d", "string", ",", "e", "bool", ",", "err", "error", ")", "{", "d", "=", "s", ".", "dir", "(", "key", ")", "\n", "_", ",", "err", "=", "os", ".", "Stat", "...
// Dir implements Storage.Dir
[ "Dir", "implements", "Storage", ".", "Dir" ]
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/folder_storage.go#L19-L39
20,979
hashicorp/go-getter
folder_storage.go
dir
func (s *FolderStorage) dir(key string) string { sum := md5.Sum([]byte(key)) return filepath.Join(s.StorageDir, hex.EncodeToString(sum[:])) }
go
func (s *FolderStorage) dir(key string) string { sum := md5.Sum([]byte(key)) return filepath.Join(s.StorageDir, hex.EncodeToString(sum[:])) }
[ "func", "(", "s", "*", "FolderStorage", ")", "dir", "(", "key", "string", ")", "string", "{", "sum", ":=", "md5", ".", "Sum", "(", "[", "]", "byte", "(", "key", ")", ")", "\n", "return", "filepath", ".", "Join", "(", "s", ".", "StorageDir", ",", ...
// dir returns the directory name internally that we'll use to map to // internally.
[ "dir", "returns", "the", "directory", "name", "internally", "that", "we", "ll", "use", "to", "map", "to", "internally", "." ]
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/folder_storage.go#L62-L65
20,980
hashicorp/go-getter
get_file_copy.go
Copy
func Copy(ctx context.Context, dst io.Writer, src io.Reader) (int64, error) { // Copy will call the Reader and Writer interface multiple time, in order // to copy by chunk (avoiding loading the whole file in memory). return io.Copy(dst, readerFunc(func(p []byte) (int, error) { select { case <-ctx.Done(): // ...
go
func Copy(ctx context.Context, dst io.Writer, src io.Reader) (int64, error) { // Copy will call the Reader and Writer interface multiple time, in order // to copy by chunk (avoiding loading the whole file in memory). return io.Copy(dst, readerFunc(func(p []byte) (int, error) { select { case <-ctx.Done(): // ...
[ "func", "Copy", "(", "ctx", "context", ".", "Context", ",", "dst", "io", ".", "Writer", ",", "src", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "// Copy will call the Reader and Writer interface multiple time, in order", "// to copy by chunk (avo...
// Copy is a io.Copy cancellable by context
[ "Copy", "is", "a", "io", ".", "Copy", "cancellable", "by", "context" ]
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/get_file_copy.go#L14-L29
20,981
hashicorp/go-getter
netrc.go
addAuthFromNetrc
func addAuthFromNetrc(u *url.URL) error { // If the URL already has auth information, do nothing if u.User != nil && u.User.Username() != "" { return nil } // Get the netrc file path path := os.Getenv("NETRC") if path == "" { filename := ".netrc" if runtime.GOOS == "windows" { filename = "_netrc" } ...
go
func addAuthFromNetrc(u *url.URL) error { // If the URL already has auth information, do nothing if u.User != nil && u.User.Username() != "" { return nil } // Get the netrc file path path := os.Getenv("NETRC") if path == "" { filename := ".netrc" if runtime.GOOS == "windows" { filename = "_netrc" } ...
[ "func", "addAuthFromNetrc", "(", "u", "*", "url", ".", "URL", ")", "error", "{", "// If the URL already has auth information, do nothing", "if", "u", ".", "User", "!=", "nil", "&&", "u", ".", "User", ".", "Username", "(", ")", "!=", "\"", "\"", "{", "retur...
// addAuthFromNetrc adds auth information to the URL from the user's // netrc file if it can be found. This will only add the auth info // if the URL doesn't already have auth info specified and the // the username is blank.
[ "addAuthFromNetrc", "adds", "auth", "information", "to", "the", "URL", "from", "the", "user", "s", "netrc", "file", "if", "it", "can", "be", "found", ".", "This", "will", "only", "add", "the", "auth", "info", "if", "the", "URL", "doesn", "t", "already", ...
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/netrc.go#L17-L67
20,982
hashicorp/go-getter
client_option.go
Configure
func (c *Client) Configure(opts ...ClientOption) error { if c.Ctx == nil { c.Ctx = context.Background() } c.Options = opts for _, opt := range opts { err := opt(c) if err != nil { return err } } // Default decompressor values if c.Decompressors == nil { c.Decompressors = Decompressors } // Default...
go
func (c *Client) Configure(opts ...ClientOption) error { if c.Ctx == nil { c.Ctx = context.Background() } c.Options = opts for _, opt := range opts { err := opt(c) if err != nil { return err } } // Default decompressor values if c.Decompressors == nil { c.Decompressors = Decompressors } // Default...
[ "func", "(", "c", "*", "Client", ")", "Configure", "(", "opts", "...", "ClientOption", ")", "error", "{", "if", "c", ".", "Ctx", "==", "nil", "{", "c", ".", "Ctx", "=", "context", ".", "Background", "(", ")", "\n", "}", "\n", "c", ".", "Options",...
// Configure configures a client with options.
[ "Configure", "configures", "a", "client", "with", "options", "." ]
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/client_option.go#L9-L37
20,983
hashicorp/go-getter
client_option.go
WithContext
func WithContext(ctx context.Context) func(*Client) error { return func(c *Client) error { c.Ctx = ctx return nil } }
go
func WithContext(ctx context.Context) func(*Client) error { return func(c *Client) error { c.Ctx = ctx return nil } }
[ "func", "WithContext", "(", "ctx", "context", ".", "Context", ")", "func", "(", "*", "Client", ")", "error", "{", "return", "func", "(", "c", "*", "Client", ")", "error", "{", "c", ".", "Ctx", "=", "ctx", "\n", "return", "nil", "\n", "}", "\n", "...
// WithContext allows to pass a context to operation // in order to be able to cancel a download in progress.
[ "WithContext", "allows", "to", "pass", "a", "context", "to", "operation", "in", "order", "to", "be", "able", "to", "cancel", "a", "download", "in", "progress", "." ]
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/client_option.go#L41-L46
20,984
hashicorp/go-getter
checksum.go
checksum
func (c *fileChecksum) checksum(source string) error { f, err := os.Open(source) if err != nil { return fmt.Errorf("Failed to open file for checksum: %s", err) } defer f.Close() c.Hash.Reset() if _, err := io.Copy(c.Hash, f); err != nil { return fmt.Errorf("Failed to hash: %s", err) } if actual := c.Hash....
go
func (c *fileChecksum) checksum(source string) error { f, err := os.Open(source) if err != nil { return fmt.Errorf("Failed to open file for checksum: %s", err) } defer f.Close() c.Hash.Reset() if _, err := io.Copy(c.Hash, f); err != nil { return fmt.Errorf("Failed to hash: %s", err) } if actual := c.Hash....
[ "func", "(", "c", "*", "fileChecksum", ")", "checksum", "(", "source", "string", ")", "error", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "source", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\""...
// checksum is a simple method to compute the checksum of a source file // and compare it to the given expected value.
[ "checksum", "is", "a", "simple", "method", "to", "compute", "the", "checksum", "of", "a", "source", "file", "and", "compare", "it", "to", "the", "given", "expected", "value", "." ]
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/checksum.go#L53-L75
20,985
hashicorp/go-getter
checksum.go
checksumFromFile
func (c *Client) checksumFromFile(checksumFile string, src *url.URL) (*fileChecksum, error) { checksumFileURL, err := urlhelper.Parse(checksumFile) if err != nil { return nil, err } tempfile, err := tmpFile("", filepath.Base(checksumFileURL.Path)) if err != nil { return nil, err } defer os.Remove(tempfile) ...
go
func (c *Client) checksumFromFile(checksumFile string, src *url.URL) (*fileChecksum, error) { checksumFileURL, err := urlhelper.Parse(checksumFile) if err != nil { return nil, err } tempfile, err := tmpFile("", filepath.Base(checksumFileURL.Path)) if err != nil { return nil, err } defer os.Remove(tempfile) ...
[ "func", "(", "c", "*", "Client", ")", "checksumFromFile", "(", "checksumFile", "string", ",", "src", "*", "url", ".", "URL", ")", "(", "*", "fileChecksum", ",", "error", ")", "{", "checksumFileURL", ",", "err", ":=", "urlhelper", ".", "Parse", "(", "ch...
// checksumsFromFile will return all the fileChecksums found in file // // checksumsFromFile will try to guess the hashing algorithm based on content // of checksum file // // checksumsFromFile will only return checksums for files that match file // behind src
[ "checksumsFromFile", "will", "return", "all", "the", "fileChecksums", "found", "in", "file", "checksumsFromFile", "will", "try", "to", "guess", "the", "hashing", "algorithm", "based", "on", "content", "of", "checksum", "file", "checksumsFromFile", "will", "only", ...
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/checksum.go#L193-L281
20,986
hashicorp/go-getter
checksum.go
parseChecksumLine
func parseChecksumLine(line string) (*fileChecksum, error) { parts := strings.Fields(line) switch len(parts) { case 4: // BSD-style checksum: // MD5 (file1) = <checksum> // MD5 (file2) = <checksum> if len(parts[1]) <= 2 || parts[1][0] != '(' || parts[1][len(parts[1])-1] != ')' { return nil, fmt.Erro...
go
func parseChecksumLine(line string) (*fileChecksum, error) { parts := strings.Fields(line) switch len(parts) { case 4: // BSD-style checksum: // MD5 (file1) = <checksum> // MD5 (file2) = <checksum> if len(parts[1]) <= 2 || parts[1][0] != '(' || parts[1][len(parts[1])-1] != ')' { return nil, fmt.Erro...
[ "func", "parseChecksumLine", "(", "line", "string", ")", "(", "*", "fileChecksum", ",", "error", ")", "{", "parts", ":=", "strings", ".", "Fields", "(", "line", ")", "\n\n", "switch", "len", "(", "parts", ")", "{", "case", "4", ":", "// BSD-style checksu...
// parseChecksumLine takes a line from a checksum file and returns // checksumType, checksumValue and filename parseChecksumLine guesses the style // of the checksum BSD vs GNU by splitting the line and by counting the parts. // of a line. // for BSD type sums parseChecksumLine guesses the hashing algorithm // by check...
[ "parseChecksumLine", "takes", "a", "line", "from", "a", "checksum", "file", "and", "returns", "checksumType", "checksumValue", "and", "filename", "parseChecksumLine", "guesses", "the", "style", "of", "the", "checksum", "BSD", "vs", "GNU", "by", "splitting", "the",...
69dec094fde6ac8d2659bff743fc0b2096ccb54f
https://github.com/hashicorp/go-getter/blob/69dec094fde6ac8d2659bff743fc0b2096ccb54f/checksum.go#L289-L314
20,987
yanzay/tbot
server.go
WithHTTPClient
func WithHTTPClient(client *http.Client) ServerOption { return func(s *Server) { s.httpClient = client } }
go
func WithHTTPClient(client *http.Client) ServerOption { return func(s *Server) { s.httpClient = client } }
[ "func", "WithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "{", "s", ".", "httpClient", "=", "client", "\n", "}", "\n", "}" ]
// WithHTTPClient sets custom http client for server.
[ "WithHTTPClient", "sets", "custom", "http", "client", "for", "server", "." ]
f0e9ff0b2e656aa7e3348a3ef59e568d87538c77
https://github.com/yanzay/tbot/blob/f0e9ff0b2e656aa7e3348a3ef59e568d87538c77/server.go#L99-L103
20,988
yanzay/tbot
server.go
Use
func (s *Server) Use(m Middleware) { s.middlewares = append(s.middlewares, m) }
go
func (s *Server) Use(m Middleware) { s.middlewares = append(s.middlewares, m) }
[ "func", "(", "s", "*", "Server", ")", "Use", "(", "m", "Middleware", ")", "{", "s", ".", "middlewares", "=", "append", "(", "s", ".", "middlewares", ",", "m", ")", "\n", "}" ]
// Use adds middleware to server
[ "Use", "adds", "middleware", "to", "server" ]
f0e9ff0b2e656aa7e3348a3ef59e568d87538c77
https://github.com/yanzay/tbot/blob/f0e9ff0b2e656aa7e3348a3ef59e568d87538c77/server.go#L113-L115
20,989
yanzay/tbot
server.go
Start
func (s *Server) Start() error { if len(s.token) == 0 { return fmt.Errorf("token is empty") } updates, err := s.getUpdates() if err != nil { return err } for { select { case update := <-updates: handleUpdate := func(update *Update) { switch { case update.Message != nil: s.handleMessage(upd...
go
func (s *Server) Start() error { if len(s.token) == 0 { return fmt.Errorf("token is empty") } updates, err := s.getUpdates() if err != nil { return err } for { select { case update := <-updates: handleUpdate := func(update *Update) { switch { case update.Message != nil: s.handleMessage(upd...
[ "func", "(", "s", "*", "Server", ")", "Start", "(", ")", "error", "{", "if", "len", "(", "s", ".", "token", ")", "==", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "updates", ",", "err", ":=", "s", ".", "...
// Start listening for updates
[ "Start", "listening", "for", "updates" ]
f0e9ff0b2e656aa7e3348a3ef59e568d87538c77
https://github.com/yanzay/tbot/blob/f0e9ff0b2e656aa7e3348a3ef59e568d87538c77/server.go#L118-L162
20,990
yanzay/tbot
server.go
HandleMessage
func (s *Server) HandleMessage(pattern string, handler func(*Message)) { rx := regexp.MustCompile(pattern) s.messageHandlers = append(s.messageHandlers, messageHandler{rx: rx, f: handler}) }
go
func (s *Server) HandleMessage(pattern string, handler func(*Message)) { rx := regexp.MustCompile(pattern) s.messageHandlers = append(s.messageHandlers, messageHandler{rx: rx, f: handler}) }
[ "func", "(", "s", "*", "Server", ")", "HandleMessage", "(", "pattern", "string", ",", "handler", "func", "(", "*", "Message", ")", ")", "{", "rx", ":=", "regexp", ".", "MustCompile", "(", "pattern", ")", "\n", "s", ".", "messageHandlers", "=", "append"...
// HandleMessage sets handler for incoming messages
[ "HandleMessage", "sets", "handler", "for", "incoming", "messages" ]
f0e9ff0b2e656aa7e3348a3ef59e568d87538c77
https://github.com/yanzay/tbot/blob/f0e9ff0b2e656aa7e3348a3ef59e568d87538c77/server.go#L259-L262
20,991
yanzay/tbot
client.go
NewClient
func NewClient(token string, httpClient *http.Client, baseURL string) *Client { return &Client{ token: token, httpClient: httpClient, url: fmt.Sprintf("%s/bot%s/", baseURL, token) + "%s", } }
go
func NewClient(token string, httpClient *http.Client, baseURL string) *Client { return &Client{ token: token, httpClient: httpClient, url: fmt.Sprintf("%s/bot%s/", baseURL, token) + "%s", } }
[ "func", "NewClient", "(", "token", "string", ",", "httpClient", "*", "http", ".", "Client", ",", "baseURL", "string", ")", "*", "Client", "{", "return", "&", "Client", "{", "token", ":", "token", ",", "httpClient", ":", "httpClient", ",", "url", ":", "...
// NewClient creates new Telegram API client
[ "NewClient", "creates", "new", "Telegram", "API", "client" ]
f0e9ff0b2e656aa7e3348a3ef59e568d87538c77
https://github.com/yanzay/tbot/blob/f0e9ff0b2e656aa7e3348a3ef59e568d87538c77/client.go#L25-L31
20,992
yanzay/tbot
client.go
GetMe
func (c *Client) GetMe() (*User, error) { me := &User{} err := c.doRequest("getMe", nil, me) return me, err }
go
func (c *Client) GetMe() (*User, error) { me := &User{} err := c.doRequest("getMe", nil, me) return me, err }
[ "func", "(", "c", "*", "Client", ")", "GetMe", "(", ")", "(", "*", "User", ",", "error", ")", "{", "me", ":=", "&", "User", "{", "}", "\n", "err", ":=", "c", ".", "doRequest", "(", "\"", "\"", ",", "nil", ",", "me", ")", "\n", "return", "me...
// GetMe returns info about bot as a User object
[ "GetMe", "returns", "info", "about", "bot", "as", "a", "User", "object" ]
f0e9ff0b2e656aa7e3348a3ef59e568d87538c77
https://github.com/yanzay/tbot/blob/f0e9ff0b2e656aa7e3348a3ef59e568d87538c77/client.go#L64-L68
20,993
yanzay/tbot
client.go
SendMediaGroup
func (c *Client) SendMediaGroup(chatID string, media []InputMedia, opts ...sendOption) ([]*Message, error) { req := url.Values{} req.Set("chat_id", chatID) m, _ := json.Marshal(media) req.Set("media", string(m)) for _, opt := range opts { opt(req) } var msgs []*Message err := c.doRequest("sendMediaGroup", req...
go
func (c *Client) SendMediaGroup(chatID string, media []InputMedia, opts ...sendOption) ([]*Message, error) { req := url.Values{} req.Set("chat_id", chatID) m, _ := json.Marshal(media) req.Set("media", string(m)) for _, opt := range opts { opt(req) } var msgs []*Message err := c.doRequest("sendMediaGroup", req...
[ "func", "(", "c", "*", "Client", ")", "SendMediaGroup", "(", "chatID", "string", ",", "media", "[", "]", "InputMedia", ",", "opts", "...", "sendOption", ")", "(", "[", "]", "*", "Message", ",", "error", ")", "{", "req", ":=", "url", ".", "Values", ...
// SendMediaGroup send a group of photos or videos as an album
[ "SendMediaGroup", "send", "a", "group", "of", "photos", "or", "videos", "as", "an", "album" ]
f0e9ff0b2e656aa7e3348a3ef59e568d87538c77
https://github.com/yanzay/tbot/blob/f0e9ff0b2e656aa7e3348a3ef59e568d87538c77/client.go#L699-L710
20,994
yanzay/tbot
helpers.go
Buttons
func Buttons(buttons [][]string) *ReplyKeyboardMarkup { keyboard := make([][]KeyboardButton, len(buttons)) for i := range buttons { keyboard[i] = make([]KeyboardButton, len(buttons[i])) for j := range buttons[i] { keyboard[i][j] = KeyboardButton{Text: buttons[i][j]} } } return &ReplyKeyboardMarkup{Keyboard...
go
func Buttons(buttons [][]string) *ReplyKeyboardMarkup { keyboard := make([][]KeyboardButton, len(buttons)) for i := range buttons { keyboard[i] = make([]KeyboardButton, len(buttons[i])) for j := range buttons[i] { keyboard[i][j] = KeyboardButton{Text: buttons[i][j]} } } return &ReplyKeyboardMarkup{Keyboard...
[ "func", "Buttons", "(", "buttons", "[", "]", "[", "]", "string", ")", "*", "ReplyKeyboardMarkup", "{", "keyboard", ":=", "make", "(", "[", "]", "[", "]", "KeyboardButton", ",", "len", "(", "buttons", ")", ")", "\n", "for", "i", ":=", "range", "button...
// Buttons construct ReplyKeyboardMarkup from strings
[ "Buttons", "construct", "ReplyKeyboardMarkup", "from", "strings" ]
f0e9ff0b2e656aa7e3348a3ef59e568d87538c77
https://github.com/yanzay/tbot/blob/f0e9ff0b2e656aa7e3348a3ef59e568d87538c77/helpers.go#L4-L13
20,995
uber/ringpop-go
swim/gossip.go
newGossip
func newGossip(node *Node, minProtocolPeriod time.Duration) *gossip { gossip := &gossip{ node: node, minProtocolPeriod: minProtocolPeriod, logger: logging.Logger("gossip").WithField("local", node.Address()), } gossip.protocol.timing = metrics.NewHistogram(metrics.NewUniformSample(10)) ...
go
func newGossip(node *Node, minProtocolPeriod time.Duration) *gossip { gossip := &gossip{ node: node, minProtocolPeriod: minProtocolPeriod, logger: logging.Logger("gossip").WithField("local", node.Address()), } gossip.protocol.timing = metrics.NewHistogram(metrics.NewUniformSample(10)) ...
[ "func", "newGossip", "(", "node", "*", "Node", ",", "minProtocolPeriod", "time", ".", "Duration", ")", "*", "gossip", "{", "gossip", ":=", "&", "gossip", "{", "node", ":", "node", ",", "minProtocolPeriod", ":", "minProtocolPeriod", ",", "logger", ":", "log...
// newGossip returns a new gossip SWIM sub-protocol with the given protocol period
[ "newGossip", "returns", "a", "new", "gossip", "SWIM", "sub", "-", "protocol", "with", "the", "given", "protocol", "period" ]
6475220d53092c8264fc6ce9416a351c960fe9fc
https://github.com/uber/ringpop-go/blob/6475220d53092c8264fc6ce9416a351c960fe9fc/swim/gossip.go#L62-L73
20,996
uber/ringpop-go
swim/gossip.go
ComputeProtocolDelay
func (g *gossip) ComputeProtocolDelay() time.Duration { g.protocol.RLock() defer g.protocol.RUnlock() var delay time.Duration if g.protocol.numPeriods != 0 { target := g.protocol.lastPeriod.Add(g.protocol.lastRate) delay = time.Duration(math.Max(float64(target.Sub(time.Now())), float64(g.minProtocolPeriod))) ...
go
func (g *gossip) ComputeProtocolDelay() time.Duration { g.protocol.RLock() defer g.protocol.RUnlock() var delay time.Duration if g.protocol.numPeriods != 0 { target := g.protocol.lastPeriod.Add(g.protocol.lastRate) delay = time.Duration(math.Max(float64(target.Sub(time.Now())), float64(g.minProtocolPeriod))) ...
[ "func", "(", "g", "*", "gossip", ")", "ComputeProtocolDelay", "(", ")", "time", ".", "Duration", "{", "g", ".", "protocol", ".", "RLock", "(", ")", "\n", "defer", "g", ".", "protocol", ".", "RUnlock", "(", ")", "\n\n", "var", "delay", "time", ".", ...
// computes a delay for the gossip protocol period
[ "computes", "a", "delay", "for", "the", "gossip", "protocol", "period" ]
6475220d53092c8264fc6ce9416a351c960fe9fc
https://github.com/uber/ringpop-go/blob/6475220d53092c8264fc6ce9416a351c960fe9fc/swim/gossip.go#L76-L94
20,997
uber/ringpop-go
swim/gossip.go
AdjustProtocolRate
func (g *gossip) AdjustProtocolRate() { g.protocol.Lock() observed := g.protocol.timing.Percentile(0.5) * 2.0 g.protocol.lastRate = time.Duration(math.Max(observed, float64(g.minProtocolPeriod))) g.protocol.Unlock() }
go
func (g *gossip) AdjustProtocolRate() { g.protocol.Lock() observed := g.protocol.timing.Percentile(0.5) * 2.0 g.protocol.lastRate = time.Duration(math.Max(observed, float64(g.minProtocolPeriod))) g.protocol.Unlock() }
[ "func", "(", "g", "*", "gossip", ")", "AdjustProtocolRate", "(", ")", "{", "g", ".", "protocol", ".", "Lock", "(", ")", "\n", "observed", ":=", "g", ".", "protocol", ".", "timing", ".", "Percentile", "(", "0.5", ")", "*", "2.0", "\n", "g", ".", "...
// computes a ProtocolRate for the Gossip
[ "computes", "a", "ProtocolRate", "for", "the", "Gossip" ]
6475220d53092c8264fc6ce9416a351c960fe9fc
https://github.com/uber/ringpop-go/blob/6475220d53092c8264fc6ce9416a351c960fe9fc/swim/gossip.go#L105-L110
20,998
uber/ringpop-go
swim/gossip.go
Start
func (g *gossip) Start() { g.state.Lock() defer g.state.Unlock() if g.state.running { g.logger.Warn("gossip already started") return } // mark the state to be running g.state.running = true // schedule repeat execution in the background g.state.protocolPeriodStop, g.state.protocolPeriodWait = scheduleRep...
go
func (g *gossip) Start() { g.state.Lock() defer g.state.Unlock() if g.state.running { g.logger.Warn("gossip already started") return } // mark the state to be running g.state.running = true // schedule repeat execution in the background g.state.protocolPeriodStop, g.state.protocolPeriodWait = scheduleRep...
[ "func", "(", "g", "*", "gossip", ")", "Start", "(", ")", "{", "g", ".", "state", ".", "Lock", "(", ")", "\n", "defer", "g", ".", "state", ".", "Unlock", "(", ")", "\n\n", "if", "g", ".", "state", ".", "running", "{", "g", ".", "logger", ".", ...
// start the gossip protocol
[ "start", "the", "gossip", "protocol" ]
6475220d53092c8264fc6ce9416a351c960fe9fc
https://github.com/uber/ringpop-go/blob/6475220d53092c8264fc6ce9416a351c960fe9fc/swim/gossip.go#L121-L140
20,999
uber/ringpop-go
swim/gossip.go
Stop
func (g *gossip) Stop() { g.state.Lock() defer g.state.Unlock() if !g.state.running { g.logger.Warn("gossip already stopped") return } g.state.running = false // stop background execution of running tasks close(g.state.protocolPeriodStop) close(g.state.protocolRateChannel) // wait for the goroutine to ...
go
func (g *gossip) Stop() { g.state.Lock() defer g.state.Unlock() if !g.state.running { g.logger.Warn("gossip already stopped") return } g.state.running = false // stop background execution of running tasks close(g.state.protocolPeriodStop) close(g.state.protocolRateChannel) // wait for the goroutine to ...
[ "func", "(", "g", "*", "gossip", ")", "Stop", "(", ")", "{", "g", ".", "state", ".", "Lock", "(", ")", "\n", "defer", "g", ".", "state", ".", "Unlock", "(", ")", "\n\n", "if", "!", "g", ".", "state", ".", "running", "{", "g", ".", "logger", ...
// stop the gossip protocol
[ "stop", "the", "gossip", "protocol" ]
6475220d53092c8264fc6ce9416a351c960fe9fc
https://github.com/uber/ringpop-go/blob/6475220d53092c8264fc6ce9416a351c960fe9fc/swim/gossip.go#L143-L162