id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
137,700
volatiletech/abcweb
abcsessions/storage_overseer.go
Set
func (s *StorageOverseer) Set(w http.ResponseWriter, r *http.Request, value string) error { // Reuse the existing cookie ID if it exists sessID, _ := s.options.getCookieValue(w, r) if len(sessID) == 0 { sessID = uuid.NewV4().String() } err := s.Storer.Set(sessID, value) if err != nil { return errors.Wrap(er...
go
func (s *StorageOverseer) Set(w http.ResponseWriter, r *http.Request, value string) error { // Reuse the existing cookie ID if it exists sessID, _ := s.options.getCookieValue(w, r) if len(sessID) == 0 { sessID = uuid.NewV4().String() } err := s.Storer.Set(sessID, value) if err != nil { return errors.Wrap(er...
[ "func", "(", "s", "*", "StorageOverseer", ")", "Set", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "value", "string", ")", "error", "{", "// Reuse the existing cookie ID if it exists", "sessID", ",", "_", ":=", "s", ...
// Set looks in the cookie for the session ID and modifies the session with the new value. // If the session does not exist it creates a new one.
[ "Set", "looks", "in", "the", "cookie", "for", "the", "session", "ID", "and", "modifies", "the", "session", "with", "the", "new", "value", ".", "If", "the", "session", "does", "not", "exist", "it", "creates", "a", "new", "one", "." ]
9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66
https://github.com/volatiletech/abcweb/blob/9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66/abcsessions/storage_overseer.go#L50-L66
137,701
volatiletech/abcweb
abcsessions/storage_overseer.go
Del
func (s *StorageOverseer) Del(w http.ResponseWriter, r *http.Request) error { sessID, err := s.options.getCookieValue(w, r) if err != nil { return nil } s.options.deleteCookie(w) err = s.Storer.Del(sessID) if IsNoSessionError(err) { return nil } else if err != nil { return errors.Wrap(err, "unable to del...
go
func (s *StorageOverseer) Del(w http.ResponseWriter, r *http.Request) error { sessID, err := s.options.getCookieValue(w, r) if err != nil { return nil } s.options.deleteCookie(w) err = s.Storer.Del(sessID) if IsNoSessionError(err) { return nil } else if err != nil { return errors.Wrap(err, "unable to del...
[ "func", "(", "s", "*", "StorageOverseer", ")", "Del", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "error", "{", "sessID", ",", "err", ":=", "s", ".", "options", ".", "getCookieValue", "(", "w", ",", "r", ")"...
// Del deletes the session if it exists and sets the session cookie to expire instantly.
[ "Del", "deletes", "the", "session", "if", "it", "exists", "and", "sets", "the", "session", "cookie", "to", "expire", "instantly", "." ]
9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66
https://github.com/volatiletech/abcweb/blob/9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66/abcsessions/storage_overseer.go#L69-L85
137,702
volatiletech/abcweb
abcsessions/storage_overseer.go
Regenerate
func (s *StorageOverseer) Regenerate(w http.ResponseWriter, r *http.Request) error { id, err := s.options.getCookieValue(w, r) if err != nil { return errors.Wrap(err, "unable to get session id from cookie") } val, err := s.Storer.Get(id) if err != nil { return errors.Wrap(err, "unable to get session value") ...
go
func (s *StorageOverseer) Regenerate(w http.ResponseWriter, r *http.Request) error { id, err := s.options.getCookieValue(w, r) if err != nil { return errors.Wrap(err, "unable to get session id from cookie") } val, err := s.Storer.Get(id) if err != nil { return errors.Wrap(err, "unable to get session value") ...
[ "func", "(", "s", "*", "StorageOverseer", ")", "Regenerate", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "error", "{", "id", ",", "err", ":=", "s", ".", "options", ".", "getCookieValue", "(", "w", ",", "r", ...
// Regenerate a new session ID for your current session
[ "Regenerate", "a", "new", "session", "ID", "for", "your", "current", "session" ]
9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66
https://github.com/volatiletech/abcweb/blob/9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66/abcsessions/storage_overseer.go#L88-L114
137,703
volatiletech/abcweb
abcsessions/storage_overseer.go
SessionID
func (s *StorageOverseer) SessionID(w http.ResponseWriter, r *http.Request) (string, error) { return s.options.getCookieValue(w, r) }
go
func (s *StorageOverseer) SessionID(w http.ResponseWriter, r *http.Request) (string, error) { return s.options.getCookieValue(w, r) }
[ "func", "(", "s", "*", "StorageOverseer", ")", "SessionID", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "(", "string", ",", "error", ")", "{", "return", "s", ".", "options", ".", "getCookieValue", "(", "w", ",...
// SessionID returns the session ID stored in the cookie's value field. // It will return a errNoSession error if no session exists.
[ "SessionID", "returns", "the", "session", "ID", "stored", "in", "the", "cookie", "s", "value", "field", ".", "It", "will", "return", "a", "errNoSession", "error", "if", "no", "session", "exists", "." ]
9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66
https://github.com/volatiletech/abcweb/blob/9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66/abcsessions/storage_overseer.go#L118-L120
137,704
volatiletech/abcweb
abcrender/render.go
HTML
func (r *Render) HTML(w io.Writer, status int, name string, binding interface{}) error { return r.Render.HTML(w, status, name, binding) }
go
func (r *Render) HTML(w io.Writer, status int, name string, binding interface{}) error { return r.Render.HTML(w, status, name, binding) }
[ "func", "(", "r", "*", "Render", ")", "HTML", "(", "w", "io", ".", "Writer", ",", "status", "int", ",", "name", "string", ",", "binding", "interface", "{", "}", ")", "error", "{", "return", "r", ".", "Render", ".", "HTML", "(", "w", ",", "status"...
// HTML renders a HTML template by calling unrolled Render package's HTML function
[ "HTML", "renders", "a", "HTML", "template", "by", "calling", "unrolled", "Render", "package", "s", "HTML", "function" ]
9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66
https://github.com/volatiletech/abcweb/blob/9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66/abcrender/render.go#L47-L49
137,705
volatiletech/abcweb
abcrender/render.go
HTMLWithLayout
func (r *Render) HTMLWithLayout(w io.Writer, status int, name string, binding interface{}, layout string) error { return r.Render.HTML(w, status, name, binding, render.HTMLOptions{Layout: layout}) }
go
func (r *Render) HTMLWithLayout(w io.Writer, status int, name string, binding interface{}, layout string) error { return r.Render.HTML(w, status, name, binding, render.HTMLOptions{Layout: layout}) }
[ "func", "(", "r", "*", "Render", ")", "HTMLWithLayout", "(", "w", "io", ".", "Writer", ",", "status", "int", ",", "name", "string", ",", "binding", "interface", "{", "}", ",", "layout", "string", ")", "error", "{", "return", "r", ".", "Render", ".", ...
// HTMLWithLayout renders a HTML template using a specified layout file by calling // unrolled Render package's HTML function with a HTMLOptions argument
[ "HTMLWithLayout", "renders", "a", "HTML", "template", "using", "a", "specified", "layout", "file", "by", "calling", "unrolled", "Render", "package", "s", "HTML", "function", "with", "a", "HTMLOptions", "argument" ]
9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66
https://github.com/volatiletech/abcweb/blob/9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66/abcrender/render.go#L53-L55
137,706
volatiletech/abcweb
abcrender/render.go
New
func New(opts render.Options, manifest map[string]string) Renderer { return &Render{ Render: render.New(opts), assetsManifest: manifest, } }
go
func New(opts render.Options, manifest map[string]string) Renderer { return &Render{ Render: render.New(opts), assetsManifest: manifest, } }
[ "func", "New", "(", "opts", "render", ".", "Options", ",", "manifest", "map", "[", "string", "]", "string", ")", "Renderer", "{", "return", "&", "Render", "{", "Render", ":", "render", ".", "New", "(", "opts", ")", ",", "assetsManifest", ":", "manifest...
// New returns a new Render with AssetsManifest and Render set
[ "New", "returns", "a", "new", "Render", "with", "AssetsManifest", "and", "Render", "set" ]
9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66
https://github.com/volatiletech/abcweb/blob/9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66/abcrender/render.go#L58-L63
137,707
volatiletech/abcweb
abcrender/render.go
GetManifest
func GetManifest(publicPath string) (map[string]string, error) { manifestPath := filepath.Join(publicPath, "assets", "manifest.json") contents, err := ioutil.ReadFile(manifestPath) if err != nil { return nil, err } if len(contents) == 0 { return nil, errors.New("manifest.json is empty") } manifest := map[st...
go
func GetManifest(publicPath string) (map[string]string, error) { manifestPath := filepath.Join(publicPath, "assets", "manifest.json") contents, err := ioutil.ReadFile(manifestPath) if err != nil { return nil, err } if len(contents) == 0 { return nil, errors.New("manifest.json is empty") } manifest := map[st...
[ "func", "GetManifest", "(", "publicPath", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "manifestPath", ":=", "filepath", ".", "Join", "(", "publicPath", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "contents", ",", ...
// GetManifest reads the manifest.json file in the public assets folder // and returns a map of its mappings. Returns error if manifest.json not found.
[ "GetManifest", "reads", "the", "manifest", ".", "json", "file", "in", "the", "public", "assets", "folder", "and", "returns", "a", "map", "of", "its", "mappings", ".", "Returns", "error", "if", "manifest", ".", "json", "not", "found", "." ]
9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66
https://github.com/volatiletech/abcweb/blob/9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66/abcrender/render.go#L67-L87
137,708
volatiletech/abcweb
abcrender/render.go
AppHelpers
func AppHelpers(manifest map[string]string) template.FuncMap { return template.FuncMap{ "liveReload": liveReloadHelper, "jsPath": func(relpath string) string { return manifestHelper("js", relpath, manifest) }, "cssPath": func(relpath string) string { return manifestHelper("css", relpath, manifest) }, "i...
go
func AppHelpers(manifest map[string]string) template.FuncMap { return template.FuncMap{ "liveReload": liveReloadHelper, "jsPath": func(relpath string) string { return manifestHelper("js", relpath, manifest) }, "cssPath": func(relpath string) string { return manifestHelper("css", relpath, manifest) }, "i...
[ "func", "AppHelpers", "(", "manifest", "map", "[", "string", "]", "string", ")", "template", ".", "FuncMap", "{", "return", "template", ".", "FuncMap", "{", "\"", "\"", ":", "liveReloadHelper", ",", "\"", "\"", ":", "func", "(", "relpath", "string", ")",...
// AppHelpers takes in the assets manifest and returns a map of the template // helper functions.
[ "AppHelpers", "takes", "in", "the", "assets", "manifest", "and", "returns", "a", "map", "of", "the", "template", "helper", "functions", "." ]
9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66
https://github.com/volatiletech/abcweb/blob/9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66/abcrender/render.go#L91-L118
137,709
volatiletech/abcweb
abcrender/render.go
liveReloadHelper
func liveReloadHelper(relpath string, host string) string { return fmt.Sprintf("/assets/js/%s?host=%s", relpath, host) }
go
func liveReloadHelper(relpath string, host string) string { return fmt.Sprintf("/assets/js/%s?host=%s", relpath, host) }
[ "func", "liveReloadHelper", "(", "relpath", "string", ",", "host", "string", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "relpath", ",", "host", ")", "\n", "}" ]
// liveReloadHelper is a helper to include the livereload javascript file // and pass through a host queryparam so that it works properly.
[ "liveReloadHelper", "is", "a", "helper", "to", "include", "the", "livereload", "javascript", "file", "and", "pass", "through", "a", "host", "queryparam", "so", "that", "it", "works", "properly", "." ]
9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66
https://github.com/volatiletech/abcweb/blob/9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66/abcrender/render.go#L130-L132
137,710
volatiletech/abcweb
abcrender/render.go
cssTag
func cssTag(relpath string) template.HTML { return template.HTML(fmt.Sprintf("<link href=\"%s\" rel=\"stylesheet\">", relpath)) }
go
func cssTag(relpath string) template.HTML { return template.HTML(fmt.Sprintf("<link href=\"%s\" rel=\"stylesheet\">", relpath)) }
[ "func", "cssTag", "(", "relpath", "string", ")", "template", ".", "HTML", "{", "return", "template", ".", "HTML", "(", "fmt", ".", "Sprintf", "(", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ",", "relpath", ")", ")", "\n", "}" ]
// cssTag wraps the asset path in a css link include tag
[ "cssTag", "wraps", "the", "asset", "path", "in", "a", "css", "link", "include", "tag" ]
9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66
https://github.com/volatiletech/abcweb/blob/9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66/abcrender/render.go#L135-L137
137,711
volatiletech/abcweb
abcrender/render.go
jsTag
func jsTag(relpath string) template.HTML { return template.HTML(fmt.Sprintf("<script src=\"%s\"></script>", relpath)) }
go
func jsTag(relpath string) template.HTML { return template.HTML(fmt.Sprintf("<script src=\"%s\"></script>", relpath)) }
[ "func", "jsTag", "(", "relpath", "string", ")", "template", ".", "HTML", "{", "return", "template", ".", "HTML", "(", "fmt", ".", "Sprintf", "(", "\"", "\\\"", "\\\"", "\"", ",", "relpath", ")", ")", "\n", "}" ]
// jsTag wraps the asset path in a javascript script include tag
[ "jsTag", "wraps", "the", "asset", "path", "in", "a", "javascript", "script", "include", "tag" ]
9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66
https://github.com/volatiletech/abcweb/blob/9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66/abcrender/render.go#L140-L142
137,712
volatiletech/abcweb
abcrender/render.go
jsBootstrap
func jsBootstrap() template.HTML { files := []string{ "/assets/js/bootstrap/transition.js", "/assets/js/bootstrap/util.js", "/assets/js/bootstrap/alert.js", "/assets/js/bootstrap/button.js", "/assets/js/bootstrap/carousel.js", "/assets/js/bootstrap/collapse.js", "/assets/js/bootstrap/dropdown.js", "/as...
go
func jsBootstrap() template.HTML { files := []string{ "/assets/js/bootstrap/transition.js", "/assets/js/bootstrap/util.js", "/assets/js/bootstrap/alert.js", "/assets/js/bootstrap/button.js", "/assets/js/bootstrap/carousel.js", "/assets/js/bootstrap/collapse.js", "/assets/js/bootstrap/dropdown.js", "/as...
[ "func", "jsBootstrap", "(", ")", "template", ".", "HTML", "{", "files", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "...
// jsBootstrap returns all javascript include tags for all twitter bootstrap // js plugins for the default generated bootstrap install.
[ "jsBootstrap", "returns", "all", "javascript", "include", "tags", "for", "all", "twitter", "bootstrap", "js", "plugins", "for", "the", "default", "generated", "bootstrap", "install", "." ]
9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66
https://github.com/volatiletech/abcweb/blob/9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66/abcrender/render.go#L146-L167
137,713
volatiletech/abcweb
abcsessions/cookie_options.go
NewCookieOptions
func NewCookieOptions() CookieOptions { return CookieOptions{ Name: "id", Path: "/", MaxAge: 0, Secure: true, HTTPOnly: true, } }
go
func NewCookieOptions() CookieOptions { return CookieOptions{ Name: "id", Path: "/", MaxAge: 0, Secure: true, HTTPOnly: true, } }
[ "func", "NewCookieOptions", "(", ")", "CookieOptions", "{", "return", "CookieOptions", "{", "Name", ":", "\"", "\"", ",", "Path", ":", "\"", "\"", ",", "MaxAge", ":", "0", ",", "Secure", ":", "true", ",", "HTTPOnly", ":", "true", ",", "}", "\n", "}" ...
// NewCookieOptions gives healthy defaults for session cookies
[ "NewCookieOptions", "gives", "healthy", "defaults", "for", "session", "cookies" ]
9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66
https://github.com/volatiletech/abcweb/blob/9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66/abcsessions/cookie_options.go#L27-L35
137,714
volatiletech/abcweb
abcsessions/cookie_options.go
deleteCookie
func (c CookieOptions) deleteCookie(w http.ResponseWriter) { cookie := &http.Cookie{ // If the browser refuses to delete it, set value to "" so subsequent // requests replace it when it does not point to a valid session id. Path: c.Path, Domain: c.Domain, Value: "", Name: c.Name, MaxAge: -...
go
func (c CookieOptions) deleteCookie(w http.ResponseWriter) { cookie := &http.Cookie{ // If the browser refuses to delete it, set value to "" so subsequent // requests replace it when it does not point to a valid session id. Path: c.Path, Domain: c.Domain, Value: "", Name: c.Name, MaxAge: -...
[ "func", "(", "c", "CookieOptions", ")", "deleteCookie", "(", "w", "http", ".", "ResponseWriter", ")", "{", "cookie", ":=", "&", "http", ".", "Cookie", "{", "// If the browser refuses to delete it, set value to \"\" so subsequent", "// requests replace it when it does not po...
// deleteCookie sets the cookie to a deleted value to force the client to delete
[ "deleteCookie", "sets", "the", "cookie", "to", "a", "deleted", "value", "to", "force", "the", "client", "to", "delete" ]
9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66
https://github.com/volatiletech/abcweb/blob/9e9ffe4fa86ed4e557dcc4b9d59ca5d3d91c6a66/abcsessions/cookie_options.go#L56-L71
137,715
nbari/violetear
trie.go
contains
func (t *Trie) contains(path, version string) (*Trie, bool) { for _, n := range t.Node { if n.path == path && n.version == version { return n, true } } return nil, false }
go
func (t *Trie) contains(path, version string) (*Trie, bool) { for _, n := range t.Node { if n.path == path && n.version == version { return n, true } } return nil, false }
[ "func", "(", "t", "*", "Trie", ")", "contains", "(", "path", ",", "version", "string", ")", "(", "*", "Trie", ",", "bool", ")", "{", "for", "_", ",", "n", ":=", "range", "t", ".", "Node", "{", "if", "n", ".", "path", "==", "path", "&&", "n", ...
// contains check if path exists on node
[ "contains", "check", "if", "path", "exists", "on", "node" ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/trie.go#L27-L34
137,716
nbari/violetear
trie.go
Get
func (t *Trie) Get(path, version string) (*Trie, string, string, bool) { key, path := t.SplitPath(path) // search the key recursively on the tree if node, ok := t.contains(key, version); ok { if path == "" { return node, key, path, true } return node.Get(path, version) } // if not fount check for catchall...
go
func (t *Trie) Get(path, version string) (*Trie, string, string, bool) { key, path := t.SplitPath(path) // search the key recursively on the tree if node, ok := t.contains(key, version); ok { if path == "" { return node, key, path, true } return node.Get(path, version) } // if not fount check for catchall...
[ "func", "(", "t", "*", "Trie", ")", "Get", "(", "path", ",", "version", "string", ")", "(", "*", "Trie", ",", "string", ",", "string", ",", "bool", ")", "{", "key", ",", "path", ":=", "t", ".", "SplitPath", "(", "path", ")", "\n", "// search the ...
// Get returns a node
[ "Get", "returns", "a", "node" ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/trie.go#L83-L94
137,717
nbari/violetear
trie.go
SplitPath
func (t *Trie) SplitPath(path string) (string, string) { var key string if path == "" { return key, path } else if path == "/" { return path, "" } for i := 0; i < len(path); i++ { if path[i] == '/' { if i == 0 { return t.SplitPath(path[1:]) } if i > 0 { key = path[:i] path = path[i:] ...
go
func (t *Trie) SplitPath(path string) (string, string) { var key string if path == "" { return key, path } else if path == "/" { return path, "" } for i := 0; i < len(path); i++ { if path[i] == '/' { if i == 0 { return t.SplitPath(path[1:]) } if i > 0 { key = path[:i] path = path[i:] ...
[ "func", "(", "t", "*", "Trie", ")", "SplitPath", "(", "path", "string", ")", "(", "string", ",", "string", ")", "{", "var", "key", "string", "\n", "if", "path", "==", "\"", "\"", "{", "return", "key", ",", "path", "\n", "}", "else", "if", "path",...
// SplitPath returns first element of path and remaining path
[ "SplitPath", "returns", "first", "element", "of", "path", "and", "remaining", "path" ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/trie.go#L97-L120
137,718
nbari/violetear
trie.go
Name
func (t *Trie) Name(name string) *Trie { t.name = name return t }
go
func (t *Trie) Name(name string) *Trie { t.name = name return t }
[ "func", "(", "t", "*", "Trie", ")", "Name", "(", "name", "string", ")", "*", "Trie", "{", "t", ".", "name", "=", "name", "\n", "return", "t", "\n", "}" ]
// Name add custom name to node
[ "Name", "add", "custom", "name", "to", "node" ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/trie.go#L123-L126
137,719
nbari/violetear
logger.go
logger
func logger(ww *ResponseWriter, r *http.Request) { log.Printf("%s [%s] %d %d %s %s", r.RemoteAddr, r.URL, ww.Status(), ww.Size(), ww.RequestTime(), ww.RequestID()) }
go
func logger(ww *ResponseWriter, r *http.Request) { log.Printf("%s [%s] %d %d %s %s", r.RemoteAddr, r.URL, ww.Status(), ww.Size(), ww.RequestTime(), ww.RequestID()) }
[ "func", "logger", "(", "ww", "*", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "r", ".", "RemoteAddr", ",", "r", ".", "URL", ",", "ww", ".", "Status", "(", ")", ",", "ww", ".", ...
// logger log values separated by space
[ "logger", "log", "values", "separated", "by", "space" ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/logger.go#L9-L17
137,720
nbari/violetear
params.go
Add
func (p Params) Add(k, v string) { if param, ok := p[k]; ok { switch param.(type) { case string: param = []string{param.(string), v} case []string: param = append(param.([]string), v) } p[k] = param } else { p[k] = v } }
go
func (p Params) Add(k, v string) { if param, ok := p[k]; ok { switch param.(type) { case string: param = []string{param.(string), v} case []string: param = append(param.([]string), v) } p[k] = param } else { p[k] = v } }
[ "func", "(", "p", "Params", ")", "Add", "(", "k", ",", "v", "string", ")", "{", "if", "param", ",", "ok", ":=", "p", "[", "k", "]", ";", "ok", "{", "switch", "param", ".", "(", "type", ")", "{", "case", "string", ":", "param", "=", "[", "]"...
// Add param to Params
[ "Add", "param", "to", "Params" ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/params.go#L11-L23
137,721
nbari/violetear
params.go
GetParam
func GetParam(name string, r *http.Request, index ...int) string { if params := r.Context().Value(ParamsKey); params != nil { params := params.(Params) if name != "*" { name = ":" + name } if param := params[name]; param != nil { switch param := param.(type) { case []string: if len(index) > 0 { ...
go
func GetParam(name string, r *http.Request, index ...int) string { if params := r.Context().Value(ParamsKey); params != nil { params := params.(Params) if name != "*" { name = ":" + name } if param := params[name]; param != nil { switch param := param.(type) { case []string: if len(index) > 0 { ...
[ "func", "GetParam", "(", "name", "string", ",", "r", "*", "http", ".", "Request", ",", "index", "...", "int", ")", "string", "{", "if", "params", ":=", "r", ".", "Context", "(", ")", ".", "Value", "(", "ParamsKey", ")", ";", "params", "!=", "nil", ...
// GetParam returns a value for the parameter set in path // When having duplicate params pass the index as the last argument to // retrieve the desired value.
[ "GetParam", "returns", "a", "value", "for", "the", "parameter", "set", "in", "path", "When", "having", "duplicate", "params", "pass", "the", "index", "as", "the", "last", "argument", "to", "retrieve", "the", "desired", "value", "." ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/params.go#L28-L50
137,722
nbari/violetear
params.go
GetRouteName
func GetRouteName(r *http.Request) string { if params := r.Context().Value(ParamsKey); params != nil { params := params.(Params) if param := params["rname"]; param != nil { return param.(string) } } return "" }
go
func GetRouteName(r *http.Request) string { if params := r.Context().Value(ParamsKey); params != nil { params := params.(Params) if param := params["rname"]; param != nil { return param.(string) } } return "" }
[ "func", "GetRouteName", "(", "r", "*", "http", ".", "Request", ")", "string", "{", "if", "params", ":=", "r", ".", "Context", "(", ")", ".", "Value", "(", "ParamsKey", ")", ";", "params", "!=", "nil", "{", "params", ":=", "params", ".", "(", "Param...
// GetRouteName return the name of the route
[ "GetRouteName", "return", "the", "name", "of", "the", "route" ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/params.go#L72-L80
137,723
nbari/violetear
responsewriter.go
NewResponseWriter
func NewResponseWriter(w http.ResponseWriter, rid string) *ResponseWriter { return &ResponseWriter{ ResponseWriter: w, requestID: rid, start: time.Now(), status: http.StatusOK, } }
go
func NewResponseWriter(w http.ResponseWriter, rid string) *ResponseWriter { return &ResponseWriter{ ResponseWriter: w, requestID: rid, start: time.Now(), status: http.StatusOK, } }
[ "func", "NewResponseWriter", "(", "w", "http", ".", "ResponseWriter", ",", "rid", "string", ")", "*", "ResponseWriter", "{", "return", "&", "ResponseWriter", "{", "ResponseWriter", ":", "w", ",", "requestID", ":", "rid", ",", "start", ":", "time", ".", "No...
// NewResponseWriter returns ResponseWriter
[ "NewResponseWriter", "returns", "ResponseWriter" ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/responsewriter.go#L17-L24
137,724
nbari/violetear
responsewriter.go
Write
func (w *ResponseWriter) Write(data []byte) (int, error) { size, err := w.ResponseWriter.Write(data) w.size += size return size, err }
go
func (w *ResponseWriter) Write(data []byte) (int, error) { size, err := w.ResponseWriter.Write(data) w.size += size return size, err }
[ "func", "(", "w", "*", "ResponseWriter", ")", "Write", "(", "data", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "size", ",", "err", ":=", "w", ".", "ResponseWriter", ".", "Write", "(", "data", ")", "\n", "w", ".", "size", "+=", "...
// Write satisfies the http.ResponseWriter interface and // captures data written, in bytes
[ "Write", "satisfies", "the", "http", ".", "ResponseWriter", "interface", "and", "captures", "data", "written", "in", "bytes" ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/responsewriter.go#L48-L52
137,725
nbari/violetear
responsewriter.go
WriteHeader
func (w *ResponseWriter) WriteHeader(statusCode int) { w.status = statusCode w.ResponseWriter.WriteHeader(statusCode) }
go
func (w *ResponseWriter) WriteHeader(statusCode int) { w.status = statusCode w.ResponseWriter.WriteHeader(statusCode) }
[ "func", "(", "w", "*", "ResponseWriter", ")", "WriteHeader", "(", "statusCode", "int", ")", "{", "w", ".", "status", "=", "statusCode", "\n", "w", ".", "ResponseWriter", ".", "WriteHeader", "(", "statusCode", ")", "\n", "}" ]
// WriteHeader satisfies the http.ResponseWriter interface and // allows us to catch the status code
[ "WriteHeader", "satisfies", "the", "http", ".", "ResponseWriter", "interface", "and", "allows", "us", "to", "catch", "the", "status", "code" ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/responsewriter.go#L56-L59
137,726
nbari/violetear
violetear.go
New
func New() *Router { return &Router{ dynamicRoutes: dynamicSet{}, routes: &Trie{}, Logger: logger, Verbose: true, } }
go
func New() *Router { return &Router{ dynamicRoutes: dynamicSet{}, routes: &Trie{}, Logger: logger, Verbose: true, } }
[ "func", "New", "(", ")", "*", "Router", "{", "return", "&", "Router", "{", "dynamicRoutes", ":", "dynamicSet", "{", "}", ",", "routes", ":", "&", "Trie", "{", "}", ",", "Logger", ":", "logger", ",", "Verbose", ":", "true", ",", "}", "\n", "}" ]
// New returns a new initialized router.
[ "New", "returns", "a", "new", "initialized", "router", "." ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/violetear.go#L102-L109
137,727
nbari/violetear
violetear.go
MethodNotAllowed
func (r *Router) MethodNotAllowed() http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed, ) }) }
go
func (r *Router) MethodNotAllowed() http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed, ) }) }
[ "func", "(", "r", "*", "Router", ")", "MethodNotAllowed", "(", ")", "http", ".", "HandlerFunc", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "http", ...
// MethodNotAllowed default handler for 405
[ "MethodNotAllowed", "default", "handler", "for", "405" ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/violetear.go#L159-L166
137,728
nbari/violetear
violetear.go
checkMethod
func (r *Router) checkMethod(node *Trie, method string) http.Handler { for _, h := range node.Handler { if h.Method == "ALL" { return h.Handler } if h.Method == method { return h.Handler } } if r.NotAllowedHandler != nil { return r.NotAllowedHandler } return r.MethodNotAllowed() }
go
func (r *Router) checkMethod(node *Trie, method string) http.Handler { for _, h := range node.Handler { if h.Method == "ALL" { return h.Handler } if h.Method == method { return h.Handler } } if r.NotAllowedHandler != nil { return r.NotAllowedHandler } return r.MethodNotAllowed() }
[ "func", "(", "r", "*", "Router", ")", "checkMethod", "(", "node", "*", "Trie", ",", "method", "string", ")", "http", ".", "Handler", "{", "for", "_", ",", "h", ":=", "range", "node", ".", "Handler", "{", "if", "h", ".", "Method", "==", "\"", "\""...
// checkMethod check if request method is allowed or not
[ "checkMethod", "check", "if", "request", "method", "is", "allowed", "or", "not" ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/violetear.go#L169-L182
137,729
nbari/violetear
violetear.go
ServeHTTP
func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) { // panic handler defer func() { if err := recover(); err != nil { log.Printf("panic: %s", err) if r.PanicHandler != nil { r.PanicHandler(w, req) } else { http.Error(w, http.StatusText(500), http.StatusInternalServerError) } ...
go
func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) { // panic handler defer func() { if err := recover(); err != nil { log.Printf("panic: %s", err) if r.PanicHandler != nil { r.PanicHandler(w, req) } else { http.Error(w, http.StatusText(500), http.StatusInternalServerError) } ...
[ "func", "(", "r", "*", "Router", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "// panic handler", "defer", "func", "(", ")", "{", "if", "err", ":=", "recover", "(", ")", ";", "err", "...
// ServeHTTP dispatches the handler registered in the matched path
[ "ServeHTTP", "dispatches", "the", "handler", "registered", "in", "the", "matched", "path" ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/violetear.go#L239-L295
137,730
nbari/violetear
violetear.go
splitPath
func (r *Router) splitPath(p string) []string { pathParts := strings.FieldsFunc(p, func(c rune) bool { return c == '/' }) // root (empty slice) if len(pathParts) == 0 { return []string{"/"} } return pathParts }
go
func (r *Router) splitPath(p string) []string { pathParts := strings.FieldsFunc(p, func(c rune) bool { return c == '/' }) // root (empty slice) if len(pathParts) == 0 { return []string{"/"} } return pathParts }
[ "func", "(", "r", "*", "Router", ")", "splitPath", "(", "p", "string", ")", "[", "]", "string", "{", "pathParts", ":=", "strings", ".", "FieldsFunc", "(", "p", ",", "func", "(", "c", "rune", ")", "bool", "{", "return", "c", "==", "'/'", "\n", "}"...
// splitPath returns an slice of the path
[ "splitPath", "returns", "an", "slice", "of", "the", "path" ]
971f3729520176a408b28de36d6f283f13b8e6d3
https://github.com/nbari/violetear/blob/971f3729520176a408b28de36d6f283f13b8e6d3/violetear.go#L298-L307
137,731
dyatlov/go-opengraph
opengraph/opengraph.go
String
func (og *OpenGraph) String() string { data, err := og.ToJSON() if err != nil { return err.Error() } return string(data[:]) }
go
func (og *OpenGraph) String() string { data, err := og.ToJSON() if err != nil { return err.Error() } return string(data[:]) }
[ "func", "(", "og", "*", "OpenGraph", ")", "String", "(", ")", "string", "{", "data", ",", "err", ":=", "og", ".", "ToJSON", "(", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", ".", "Error", "(", ")", "\n", "}", "\n\n", "return", "...
// String return json representation of structure, or error string
[ "String", "return", "json", "representation", "of", "structure", "or", "error", "string" ]
816b6608b3c8c1e871bc9cf777f390e2532081fe
https://github.com/dyatlov/go-opengraph/blob/816b6608b3c8c1e871bc9cf777f390e2532081fe/opengraph/opengraph.go#L99-L107
137,732
dyatlov/go-opengraph
opengraph/opengraph.go
ProcessHTML
func (og *OpenGraph) ProcessHTML(buffer io.Reader) error { z := html.NewTokenizer(buffer) for { tt := z.Next() switch tt { case html.ErrorToken: if z.Err() == io.EOF { return nil } return z.Err() case html.StartTagToken, html.SelfClosingTagToken, html.EndTagToken: name, hasAttr := z.TagName() ...
go
func (og *OpenGraph) ProcessHTML(buffer io.Reader) error { z := html.NewTokenizer(buffer) for { tt := z.Next() switch tt { case html.ErrorToken: if z.Err() == io.EOF { return nil } return z.Err() case html.StartTagToken, html.SelfClosingTagToken, html.EndTagToken: name, hasAttr := z.TagName() ...
[ "func", "(", "og", "*", "OpenGraph", ")", "ProcessHTML", "(", "buffer", "io", ".", "Reader", ")", "error", "{", "z", ":=", "html", ".", "NewTokenizer", "(", "buffer", ")", "\n", "for", "{", "tt", ":=", "z", ".", "Next", "(", ")", "\n", "switch", ...
// ProcessHTML parses given html from Reader interface and fills up OpenGraph structure
[ "ProcessHTML", "parses", "given", "html", "from", "Reader", "interface", "and", "fills", "up", "OpenGraph", "structure" ]
816b6608b3c8c1e871bc9cf777f390e2532081fe
https://github.com/dyatlov/go-opengraph/blob/816b6608b3c8c1e871bc9cf777f390e2532081fe/opengraph/opengraph.go#L110-L137
137,733
kelvins/sunrisesunset
sunrisesunset.go
GetSunriseSunset
func (p *Parameters) GetSunriseSunset() (time.Time, time.Time, error) { return GetSunriseSunset(p.Latitude, p.Longitude, p.UtcOffset, p.Date) }
go
func (p *Parameters) GetSunriseSunset() (time.Time, time.Time, error) { return GetSunriseSunset(p.Latitude, p.Longitude, p.UtcOffset, p.Date) }
[ "func", "(", "p", "*", "Parameters", ")", "GetSunriseSunset", "(", ")", "(", "time", ".", "Time", ",", "time", ".", "Time", ",", "error", ")", "{", "return", "GetSunriseSunset", "(", "p", ".", "Latitude", ",", "p", ".", "Longitude", ",", "p", ".", ...
// Just call the 'general' GetSunriseSunset function and return the results
[ "Just", "call", "the", "general", "GetSunriseSunset", "function", "and", "return", "the", "results" ]
14f1915ad4b4fc68cdf3c144e39293993e21c67c
https://github.com/kelvins/sunrisesunset/blob/14f1915ad4b4fc68cdf3c144e39293993e21c67c/sunrisesunset.go#L22-L24
137,734
kelvins/sunrisesunset
sunrisesunset.go
createSecondsNormalized
func createSecondsNormalized(seconds int) (vector []float64) { for index := 0; index < seconds; index++ { temp := float64(index) / float64(seconds-1) vector = append(vector, temp) } return }
go
func createSecondsNormalized(seconds int) (vector []float64) { for index := 0; index < seconds; index++ { temp := float64(index) / float64(seconds-1) vector = append(vector, temp) } return }
[ "func", "createSecondsNormalized", "(", "seconds", "int", ")", "(", "vector", "[", "]", "float64", ")", "{", "for", "index", ":=", "0", ";", "index", "<", "seconds", ";", "index", "++", "{", "temp", ":=", "float64", "(", "index", ")", "/", "float64", ...
// Creates a vector with the seconds normalized to the range 0~1. // seconds - The number of seconds will be normalized to 1 // Return A vector with the seconds normalized to 0~1
[ "Creates", "a", "vector", "with", "the", "seconds", "normalized", "to", "the", "range", "0~1", ".", "seconds", "-", "The", "number", "of", "seconds", "will", "be", "normalized", "to", "1", "Return", "A", "vector", "with", "the", "seconds", "normalized", "t...
14f1915ad4b4fc68cdf3c144e39293993e21c67c
https://github.com/kelvins/sunrisesunset/blob/14f1915ad4b4fc68cdf3c144e39293993e21c67c/sunrisesunset.go#L39-L45
137,735
kelvins/sunrisesunset
sunrisesunset.go
checkDate
func checkDate(date time.Time) bool { minDate := time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC) maxDate := time.Date(2200, 1, 1, 0, 0, 0, 0, time.UTC) if date.Before(minDate) || date.After(maxDate) { return false } return true }
go
func checkDate(date time.Time) bool { minDate := time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC) maxDate := time.Date(2200, 1, 1, 0, 0, 0, 0, time.UTC) if date.Before(minDate) || date.After(maxDate) { return false } return true }
[ "func", "checkDate", "(", "date", "time", ".", "Time", ")", "bool", "{", "minDate", ":=", "time", ".", "Date", "(", "1900", ",", "1", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "time", ".", "UTC", ")", "\n", "maxDate", ":=", "time...
// Check if the date is valid.
[ "Check", "if", "the", "date", "is", "valid", "." ]
14f1915ad4b4fc68cdf3c144e39293993e21c67c
https://github.com/kelvins/sunrisesunset/blob/14f1915ad4b4fc68cdf3c144e39293993e21c67c/sunrisesunset.go#L274-L281
137,736
kelvins/sunrisesunset
sunrisesunset.go
diffDays
func diffDays(date1, date2 time.Time) int64 { return int64(date2.Sub(date1) / (24 * time.Hour)) }
go
func diffDays(date1, date2 time.Time) int64 { return int64(date2.Sub(date1) / (24 * time.Hour)) }
[ "func", "diffDays", "(", "date1", ",", "date2", "time", ".", "Time", ")", "int64", "{", "return", "int64", "(", "date2", ".", "Sub", "(", "date1", ")", "/", "(", "24", "*", "time", ".", "Hour", ")", ")", "\n", "}" ]
// Compute the number of days between two dates
[ "Compute", "the", "number", "of", "days", "between", "two", "dates" ]
14f1915ad4b4fc68cdf3c144e39293993e21c67c
https://github.com/kelvins/sunrisesunset/blob/14f1915ad4b4fc68cdf3c144e39293993e21c67c/sunrisesunset.go#L284-L286
137,737
kelvins/sunrisesunset
sunrisesunset.go
minIndex
func minIndex(slice []float64) int { if len(slice) == 0 { return -1 } min := slice[0] minIndex := 0 for index := 0; index < len(slice); index++ { if slice[index] < min { min = slice[index] minIndex = index } } return minIndex }
go
func minIndex(slice []float64) int { if len(slice) == 0 { return -1 } min := slice[0] minIndex := 0 for index := 0; index < len(slice); index++ { if slice[index] < min { min = slice[index] minIndex = index } } return minIndex }
[ "func", "minIndex", "(", "slice", "[", "]", "float64", ")", "int", "{", "if", "len", "(", "slice", ")", "==", "0", "{", "return", "-", "1", "\n", "}", "\n", "min", ":=", "slice", "[", "0", "]", "\n", "minIndex", ":=", "0", "\n", "for", "index",...
// Find the index of the minimum value
[ "Find", "the", "index", "of", "the", "minimum", "value" ]
14f1915ad4b4fc68cdf3c144e39293993e21c67c
https://github.com/kelvins/sunrisesunset/blob/14f1915ad4b4fc68cdf3c144e39293993e21c67c/sunrisesunset.go#L289-L302
137,738
kelvins/sunrisesunset
sunrisesunset.go
abs
func abs(slice []float64) []float64 { var newSlice []float64 for _, value := range slice { if value < 0.0 { value = math.Abs(value) } newSlice = append(newSlice, value) } return newSlice }
go
func abs(slice []float64) []float64 { var newSlice []float64 for _, value := range slice { if value < 0.0 { value = math.Abs(value) } newSlice = append(newSlice, value) } return newSlice }
[ "func", "abs", "(", "slice", "[", "]", "float64", ")", "[", "]", "float64", "{", "var", "newSlice", "[", "]", "float64", "\n", "for", "_", ",", "value", ":=", "range", "slice", "{", "if", "value", "<", "0.0", "{", "value", "=", "math", ".", "Abs"...
// Convert each value to the absolute value
[ "Convert", "each", "value", "to", "the", "absolute", "value" ]
14f1915ad4b4fc68cdf3c144e39293993e21c67c
https://github.com/kelvins/sunrisesunset/blob/14f1915ad4b4fc68cdf3c144e39293993e21c67c/sunrisesunset.go#L305-L314
137,739
uber-go/mapdecode
internal/mapstructure/mapstructure.go
Decode
func Decode(m interface{}, rawVal interface{}) error { config := &DecoderConfig{ Metadata: nil, Result: rawVal, } decoder, err := NewDecoder(config) if err != nil { return err } return decoder.Decode(m) }
go
func Decode(m interface{}, rawVal interface{}) error { config := &DecoderConfig{ Metadata: nil, Result: rawVal, } decoder, err := NewDecoder(config) if err != nil { return err } return decoder.Decode(m) }
[ "func", "Decode", "(", "m", "interface", "{", "}", ",", "rawVal", "interface", "{", "}", ")", "error", "{", "config", ":=", "&", "DecoderConfig", "{", "Metadata", ":", "nil", ",", "Result", ":", "rawVal", ",", "}", "\n\n", "decoder", ",", "err", ":="...
// Decode takes a map and uses reflection to convert it into the // given Go native structure. val must be a pointer to a struct.
[ "Decode", "takes", "a", "map", "and", "uses", "reflection", "to", "convert", "it", "into", "the", "given", "Go", "native", "structure", ".", "val", "must", "be", "a", "pointer", "to", "a", "struct", "." ]
0cdb2a72cb565feae631bada7548587de7b1ce18
https://github.com/uber-go/mapdecode/blob/0cdb2a72cb565feae631bada7548587de7b1ce18/internal/mapstructure/mapstructure.go#L136-L148
137,740
uber-go/mapdecode
internal/mapstructure/mapstructure.go
Decode
func (d *Decoder) Decode(raw interface{}) error { return d.decode("", raw, reflect.ValueOf(d.config.Result).Elem()) }
go
func (d *Decoder) Decode(raw interface{}) error { return d.decode("", raw, reflect.ValueOf(d.config.Result).Elem()) }
[ "func", "(", "d", "*", "Decoder", ")", "Decode", "(", "raw", "interface", "{", "}", ")", "error", "{", "return", "d", ".", "decode", "(", "\"", "\"", ",", "raw", ",", "reflect", ".", "ValueOf", "(", "d", ".", "config", ".", "Result", ")", ".", ...
// Decode decodes the given raw interface to the target pointer specified // by the configuration.
[ "Decode", "decodes", "the", "given", "raw", "interface", "to", "the", "target", "pointer", "specified", "by", "the", "configuration", "." ]
0cdb2a72cb565feae631bada7548587de7b1ce18
https://github.com/uber-go/mapdecode/blob/0cdb2a72cb565feae631bada7548587de7b1ce18/internal/mapstructure/mapstructure.go#L204-L206
137,741
uber-go/mapdecode
decode.go
FieldHook
func FieldHook(f FieldHookFunc) Option { return func(o *options) { o.FieldHooks = append(o.FieldHooks, f) } }
go
func FieldHook(f FieldHookFunc) Option { return func(o *options) { o.FieldHooks = append(o.FieldHooks, f) } }
[ "func", "FieldHook", "(", "f", "FieldHookFunc", ")", "Option", "{", "return", "func", "(", "o", "*", "options", ")", "{", "o", ".", "FieldHooks", "=", "append", "(", "o", ".", "FieldHooks", ",", "f", ")", "\n", "}", "\n", "}" ]
// FieldHook registers a hook to be called when a struct field is being // decoded by the system. // // This hook will be called with information about the target field of a // struct and the source data that will fill it. // // Field hooks may return a value of the same type as the source data or the // same type as t...
[ "FieldHook", "registers", "a", "hook", "to", "be", "called", "when", "a", "struct", "field", "is", "being", "decoded", "by", "the", "system", ".", "This", "hook", "will", "be", "called", "with", "information", "about", "the", "target", "field", "of", "a", ...
0cdb2a72cb565feae631bada7548587de7b1ce18
https://github.com/uber-go/mapdecode/blob/0cdb2a72cb565feae631bada7548587de7b1ce18/decode.go#L92-L96
137,742
uber-go/mapdecode
decode.go
DecodeHook
func DecodeHook(f DecodeHookFunc) Option { return func(o *options) { o.DecodeHooks = append(o.DecodeHooks, f) } }
go
func DecodeHook(f DecodeHookFunc) Option { return func(o *options) { o.DecodeHooks = append(o.DecodeHooks, f) } }
[ "func", "DecodeHook", "(", "f", "DecodeHookFunc", ")", "Option", "{", "return", "func", "(", "o", "*", "options", ")", "{", "o", ".", "DecodeHooks", "=", "append", "(", "o", ".", "DecodeHooks", ",", "f", ")", "\n", "}", "\n", "}" ]
// DecodeHook registers a hook to be called before a value is decoded by the // system. // // This hook will be called with information about the target type and the // source data that will fill it. // // Multiple decode hooks may be specified by providing this option multiple // times. Hooks are exected in-order, fee...
[ "DecodeHook", "registers", "a", "hook", "to", "be", "called", "before", "a", "value", "is", "decoded", "by", "the", "system", ".", "This", "hook", "will", "be", "called", "with", "information", "about", "the", "target", "type", "and", "the", "source", "dat...
0cdb2a72cb565feae631bada7548587de7b1ce18
https://github.com/uber-go/mapdecode/blob/0cdb2a72cb565feae631bada7548587de7b1ce18/decode.go#L107-L111
137,743
uber-go/mapdecode
decode.go
decodeFrom
func decodeFrom(opts *options, src interface{}) Into { return func(dest interface{}) error { var fieldHooks FieldHookFunc hooks := opts.DecodeHooks // fieldHook goes first because it may replace the source data map. if len(opts.FieldHooks) > 0 { fieldHooks = composeFieldHooks(opts.FieldHooks) } hooks ...
go
func decodeFrom(opts *options, src interface{}) Into { return func(dest interface{}) error { var fieldHooks FieldHookFunc hooks := opts.DecodeHooks // fieldHook goes first because it may replace the source data map. if len(opts.FieldHooks) > 0 { fieldHooks = composeFieldHooks(opts.FieldHooks) } hooks ...
[ "func", "decodeFrom", "(", "opts", "*", "options", ",", "src", "interface", "{", "}", ")", "Into", "{", "return", "func", "(", "dest", "interface", "{", "}", ")", "error", "{", "var", "fieldHooks", "FieldHookFunc", "\n", "hooks", ":=", "opts", ".", "De...
// decodeFrom builds a decode Into function that reads the given value into // the destination.
[ "decodeFrom", "builds", "a", "decode", "Into", "function", "that", "reads", "the", "given", "value", "into", "the", "destination", "." ]
0cdb2a72cb565feae631bada7548587de7b1ce18
https://github.com/uber-go/mapdecode/blob/0cdb2a72cb565feae631bada7548587de7b1ce18/decode.go#L164-L208
137,744
uber-go/mapdecode
hooks.go
composeDecodeHooks
func composeDecodeHooks(hooks []DecodeHookFunc) DecodeHookFunc { return func(from, to reflect.Type, data reflect.Value) (reflect.Value, error) { var err error for _, hook := range hooks { data, err = hook(from, to, data) if err != nil { return data, err } // Update the `from` type to reflect chang...
go
func composeDecodeHooks(hooks []DecodeHookFunc) DecodeHookFunc { return func(from, to reflect.Type, data reflect.Value) (reflect.Value, error) { var err error for _, hook := range hooks { data, err = hook(from, to, data) if err != nil { return data, err } // Update the `from` type to reflect chang...
[ "func", "composeDecodeHooks", "(", "hooks", "[", "]", "DecodeHookFunc", ")", "DecodeHookFunc", "{", "return", "func", "(", "from", ",", "to", "reflect", ".", "Type", ",", "data", "reflect", ".", "Value", ")", "(", "reflect", ".", "Value", ",", "error", "...
// Composes multiple DecodeHookFuncs into one. The hooks are applied in-order // and values produced by a hook are fed into the next hook.
[ "Composes", "multiple", "DecodeHookFuncs", "into", "one", ".", "The", "hooks", "are", "applied", "in", "-", "order", "and", "values", "produced", "by", "a", "hook", "are", "fed", "into", "the", "next", "hook", "." ]
0cdb2a72cb565feae631bada7548587de7b1ce18
https://github.com/uber-go/mapdecode/blob/0cdb2a72cb565feae631bada7548587de7b1ce18/hooks.go#L80-L94
137,745
uber-go/mapdecode
hooks.go
unmarshalerHook
func unmarshalerHook(opts *options) DecodeHookFunc { return func(from, to reflect.Type, data reflect.Value) (reflect.Value, error) { if from == to { return data, nil } if !reflect.PtrTo(to).Implements(opts.Unmarshaler.Interface) { return data, nil } // The following lines are roughly equivalent to, ...
go
func unmarshalerHook(opts *options) DecodeHookFunc { return func(from, to reflect.Type, data reflect.Value) (reflect.Value, error) { if from == to { return data, nil } if !reflect.PtrTo(to).Implements(opts.Unmarshaler.Interface) { return data, nil } // The following lines are roughly equivalent to, ...
[ "func", "unmarshalerHook", "(", "opts", "*", "options", ")", "DecodeHookFunc", "{", "return", "func", "(", "from", ",", "to", "reflect", ".", "Type", ",", "data", "reflect", ".", "Value", ")", "(", "reflect", ".", "Value", ",", "error", ")", "{", "if",...
// Builds a DecodeHookFunc which unmarshals types using the given unmarshaling // scheme. See the unmarshaler type for more information.
[ "Builds", "a", "DecodeHookFunc", "which", "unmarshals", "types", "using", "the", "given", "unmarshaling", "scheme", ".", "See", "the", "unmarshaler", "type", "for", "more", "information", "." ]
0cdb2a72cb565feae631bada7548587de7b1ce18
https://github.com/uber-go/mapdecode/blob/0cdb2a72cb565feae631bada7548587de7b1ce18/hooks.go#L139-L160
137,746
uber-go/mapdecode
hooks.go
durationHook
func durationHook(from, to reflect.Type, data reflect.Value) (reflect.Value, error) { if from.Kind() != reflect.String || to != _typeOfDuration { return data, nil } d, err := time.ParseDuration(data.String()) return reflect.ValueOf(d), err }
go
func durationHook(from, to reflect.Type, data reflect.Value) (reflect.Value, error) { if from.Kind() != reflect.String || to != _typeOfDuration { return data, nil } d, err := time.ParseDuration(data.String()) return reflect.ValueOf(d), err }
[ "func", "durationHook", "(", "from", ",", "to", "reflect", ".", "Type", ",", "data", "reflect", ".", "Value", ")", "(", "reflect", ".", "Value", ",", "error", ")", "{", "if", "from", ".", "Kind", "(", ")", "!=", "reflect", ".", "String", "||", "to"...
// A DecodeHookFunc which decodes strings into time.Durations.
[ "A", "DecodeHookFunc", "which", "decodes", "strings", "into", "time", ".", "Durations", "." ]
0cdb2a72cb565feae631bada7548587de7b1ce18
https://github.com/uber-go/mapdecode/blob/0cdb2a72cb565feae631bada7548587de7b1ce18/hooks.go#L163-L170
137,747
uber-go/mapdecode
hooks.go
strconvHook
func strconvHook(from, to reflect.Type, data reflect.Value) (reflect.Value, error) { if from.Kind() != reflect.String { return data, nil } s := data.String() switch to.Kind() { case reflect.Bool: b, err := strconv.ParseBool(s) return reflect.ValueOf(b), err case reflect.Float32, reflect.Float64: f, err :...
go
func strconvHook(from, to reflect.Type, data reflect.Value) (reflect.Value, error) { if from.Kind() != reflect.String { return data, nil } s := data.String() switch to.Kind() { case reflect.Bool: b, err := strconv.ParseBool(s) return reflect.ValueOf(b), err case reflect.Float32, reflect.Float64: f, err :...
[ "func", "strconvHook", "(", "from", ",", "to", "reflect", ".", "Type", ",", "data", "reflect", ".", "Value", ")", "(", "reflect", ".", "Value", ",", "error", ")", "{", "if", "from", ".", "Kind", "(", ")", "!=", "reflect", ".", "String", "{", "retur...
// stringToPrimitivesHook is a DecodeHookFunc which decodes strings into // primitives. // // Integers are parsed in base 10.
[ "stringToPrimitivesHook", "is", "a", "DecodeHookFunc", "which", "decodes", "strings", "into", "primitives", ".", "Integers", "are", "parsed", "in", "base", "10", "." ]
0cdb2a72cb565feae631bada7548587de7b1ce18
https://github.com/uber-go/mapdecode/blob/0cdb2a72cb565feae631bada7548587de7b1ce18/hooks.go#L176-L198
137,748
agext/levenshtein
levenshtein.go
Distance
func Distance(str1, str2 string, p *Params) int { if p == nil { p = defaultParams } dist, _, _ := Calculate([]rune(str1), []rune(str2), p.maxCost, p.insCost, p.subCost, p.delCost) return dist }
go
func Distance(str1, str2 string, p *Params) int { if p == nil { p = defaultParams } dist, _, _ := Calculate([]rune(str1), []rune(str2), p.maxCost, p.insCost, p.subCost, p.delCost) return dist }
[ "func", "Distance", "(", "str1", ",", "str2", "string", ",", "p", "*", "Params", ")", "int", "{", "if", "p", "==", "nil", "{", "p", "=", "defaultParams", "\n", "}", "\n", "dist", ",", "_", ",", "_", ":=", "Calculate", "(", "[", "]", "rune", "("...
// Distance returns the Levenshtein distance between str1 and str2, using the // default or provided cost values. Pass nil for the third argument to use the // default cost of 1 for all three operations, with no maximum.
[ "Distance", "returns", "the", "Levenshtein", "distance", "between", "str1", "and", "str2", "using", "the", "default", "or", "provided", "cost", "values", ".", "Pass", "nil", "for", "the", "third", "argument", "to", "use", "the", "default", "cost", "of", "1",...
0ded9c86537917af2ff89bc9c78de6bd58477894
https://github.com/agext/levenshtein/blob/0ded9c86537917af2ff89bc9c78de6bd58477894/levenshtein.go#L196-L202
137,749
agext/levenshtein
levenshtein.go
Similarity
func Similarity(str1, str2 string, p *Params) float64 { return Match(str1, str2, p.Clone().BonusThreshold(1.1)) // guaranteed no bonus }
go
func Similarity(str1, str2 string, p *Params) float64 { return Match(str1, str2, p.Clone().BonusThreshold(1.1)) // guaranteed no bonus }
[ "func", "Similarity", "(", "str1", ",", "str2", "string", ",", "p", "*", "Params", ")", "float64", "{", "return", "Match", "(", "str1", ",", "str2", ",", "p", ".", "Clone", "(", ")", ".", "BonusThreshold", "(", "1.1", ")", ")", "// guaranteed no bonus"...
// Similarity returns a score in the range of 0..1 for how similar the two strings are. // A score of 1 means the strings are identical, and 0 means they have nothing in common. // // A nil third argument uses the default cost of 1 for all three operations. // // If a non-zero MinScore value is provided in the paramete...
[ "Similarity", "returns", "a", "score", "in", "the", "range", "of", "0", "..", "1", "for", "how", "similar", "the", "two", "strings", "are", ".", "A", "score", "of", "1", "means", "the", "strings", "are", "identical", "and", "0", "means", "they", "have"...
0ded9c86537917af2ff89bc9c78de6bd58477894
https://github.com/agext/levenshtein/blob/0ded9c86537917af2ff89bc9c78de6bd58477894/levenshtein.go#L211-L213
137,750
agext/levenshtein
levenshtein.go
Match
func Match(str1, str2 string, p *Params) float64 { s1, s2 := []rune(str1), []rune(str2) l1, l2 := len(s1), len(s2) // two empty strings are identical; shortcut also avoids divByZero issues later on. if l1 == 0 && l2 == 0 { return 1 } if p == nil { p = defaultParams } // a min over 1 can never be satisfied...
go
func Match(str1, str2 string, p *Params) float64 { s1, s2 := []rune(str1), []rune(str2) l1, l2 := len(s1), len(s2) // two empty strings are identical; shortcut also avoids divByZero issues later on. if l1 == 0 && l2 == 0 { return 1 } if p == nil { p = defaultParams } // a min over 1 can never be satisfied...
[ "func", "Match", "(", "str1", ",", "str2", "string", ",", "p", "*", "Params", ")", "float64", "{", "s1", ",", "s2", ":=", "[", "]", "rune", "(", "str1", ")", ",", "[", "]", "rune", "(", "str2", ")", "\n", "l1", ",", "l2", ":=", "len", "(", ...
// Match returns a similarity score adjusted by the same method as proposed by Winkler for // the Jaro distance - giving a bonus to string pairs that share a common prefix, only if their // similarity score is already over a threshold. // // The score is in the range of 0..1, with 1 meaning the strings are identical, /...
[ "Match", "returns", "a", "similarity", "score", "adjusted", "by", "the", "same", "method", "as", "proposed", "by", "Winkler", "for", "the", "Jaro", "distance", "-", "giving", "a", "bonus", "to", "string", "pairs", "that", "share", "a", "common", "prefix", ...
0ded9c86537917af2ff89bc9c78de6bd58477894
https://github.com/agext/levenshtein/blob/0ded9c86537917af2ff89bc9c78de6bd58477894/levenshtein.go#L227-L290
137,751
agext/levenshtein
params.go
NewParams
func NewParams() *Params { return &Params{ insCost: 1, subCost: 1, delCost: 1, maxCost: 0, minScore: 0, bonusPrefix: 4, bonusScale: .1, bonusThreshold: .7, } }
go
func NewParams() *Params { return &Params{ insCost: 1, subCost: 1, delCost: 1, maxCost: 0, minScore: 0, bonusPrefix: 4, bonusScale: .1, bonusThreshold: .7, } }
[ "func", "NewParams", "(", ")", "*", "Params", "{", "return", "&", "Params", "{", "insCost", ":", "1", ",", "subCost", ":", "1", ",", "delCost", ":", "1", ",", "maxCost", ":", "0", ",", "minScore", ":", "0", ",", "bonusPrefix", ":", "4", ",", "bon...
// NewParams creates a new set of parameters and initializes it with the default values.
[ "NewParams", "creates", "a", "new", "set", "of", "parameters", "and", "initializes", "it", "with", "the", "default", "values", "." ]
0ded9c86537917af2ff89bc9c78de6bd58477894
https://github.com/agext/levenshtein/blob/0ded9c86537917af2ff89bc9c78de6bd58477894/params.go#L35-L46
137,752
agext/levenshtein
params.go
Clone
func (p *Params) Clone() *Params { if p == nil { return NewParams() } return &Params{ insCost: p.insCost, subCost: p.subCost, delCost: p.delCost, maxCost: p.maxCost, minScore: p.minScore, bonusPrefix: p.bonusPrefix, bonusScale: p.bonusScale, bonusThreshold: ...
go
func (p *Params) Clone() *Params { if p == nil { return NewParams() } return &Params{ insCost: p.insCost, subCost: p.subCost, delCost: p.delCost, maxCost: p.maxCost, minScore: p.minScore, bonusPrefix: p.bonusPrefix, bonusScale: p.bonusScale, bonusThreshold: ...
[ "func", "(", "p", "*", "Params", ")", "Clone", "(", ")", "*", "Params", "{", "if", "p", "==", "nil", "{", "return", "NewParams", "(", ")", "\n", "}", "\n", "return", "&", "Params", "{", "insCost", ":", "p", ".", "insCost", ",", "subCost", ":", ...
// Clone returns a pointer to a copy of the receiver parameter set, or of a new // default parameter set if the receiver is nil.
[ "Clone", "returns", "a", "pointer", "to", "a", "copy", "of", "the", "receiver", "parameter", "set", "or", "of", "a", "new", "default", "parameter", "set", "if", "the", "receiver", "is", "nil", "." ]
0ded9c86537917af2ff89bc9c78de6bd58477894
https://github.com/agext/levenshtein/blob/0ded9c86537917af2ff89bc9c78de6bd58477894/params.go#L50-L64
137,753
agext/levenshtein
params.go
InsCost
func (p *Params) InsCost(v int) *Params { if v >= 0 { p.insCost = v } return p }
go
func (p *Params) InsCost(v int) *Params { if v >= 0 { p.insCost = v } return p }
[ "func", "(", "p", "*", "Params", ")", "InsCost", "(", "v", "int", ")", "*", "Params", "{", "if", "v", ">=", "0", "{", "p", ".", "insCost", "=", "v", "\n", "}", "\n", "return", "p", "\n", "}" ]
// InsCost overrides the default value of 1 for the cost of insertion. // The new value must be zero or positive.
[ "InsCost", "overrides", "the", "default", "value", "of", "1", "for", "the", "cost", "of", "insertion", ".", "The", "new", "value", "must", "be", "zero", "or", "positive", "." ]
0ded9c86537917af2ff89bc9c78de6bd58477894
https://github.com/agext/levenshtein/blob/0ded9c86537917af2ff89bc9c78de6bd58477894/params.go#L68-L73
137,754
agext/levenshtein
params.go
SubCost
func (p *Params) SubCost(v int) *Params { if v >= 0 { p.subCost = v } return p }
go
func (p *Params) SubCost(v int) *Params { if v >= 0 { p.subCost = v } return p }
[ "func", "(", "p", "*", "Params", ")", "SubCost", "(", "v", "int", ")", "*", "Params", "{", "if", "v", ">=", "0", "{", "p", ".", "subCost", "=", "v", "\n", "}", "\n", "return", "p", "\n", "}" ]
// SubCost overrides the default value of 1 for the cost of substitution. // The new value must be zero or positive.
[ "SubCost", "overrides", "the", "default", "value", "of", "1", "for", "the", "cost", "of", "substitution", ".", "The", "new", "value", "must", "be", "zero", "or", "positive", "." ]
0ded9c86537917af2ff89bc9c78de6bd58477894
https://github.com/agext/levenshtein/blob/0ded9c86537917af2ff89bc9c78de6bd58477894/params.go#L77-L82
137,755
agext/levenshtein
params.go
DelCost
func (p *Params) DelCost(v int) *Params { if v >= 0 { p.delCost = v } return p }
go
func (p *Params) DelCost(v int) *Params { if v >= 0 { p.delCost = v } return p }
[ "func", "(", "p", "*", "Params", ")", "DelCost", "(", "v", "int", ")", "*", "Params", "{", "if", "v", ">=", "0", "{", "p", ".", "delCost", "=", "v", "\n", "}", "\n", "return", "p", "\n", "}" ]
// DelCost overrides the default value of 1 for the cost of deletion. // The new value must be zero or positive.
[ "DelCost", "overrides", "the", "default", "value", "of", "1", "for", "the", "cost", "of", "deletion", ".", "The", "new", "value", "must", "be", "zero", "or", "positive", "." ]
0ded9c86537917af2ff89bc9c78de6bd58477894
https://github.com/agext/levenshtein/blob/0ded9c86537917af2ff89bc9c78de6bd58477894/params.go#L86-L91
137,756
mattn/go-jsonpointer
jsonpointer.go
Has
func Has(obj interface{}, pointer string) (rv bool) { defer func() { if e := recover(); e != nil { rv = false } }() tokens, err := parse(pointer) if err != nil { return false } i := 0 v := reflect.ValueOf(obj) if len(tokens) > 0 && tokens[0] != "" { for i < len(tokens) { for v.Kind() == reflect.I...
go
func Has(obj interface{}, pointer string) (rv bool) { defer func() { if e := recover(); e != nil { rv = false } }() tokens, err := parse(pointer) if err != nil { return false } i := 0 v := reflect.ValueOf(obj) if len(tokens) > 0 && tokens[0] != "" { for i < len(tokens) { for v.Kind() == reflect.I...
[ "func", "Has", "(", "obj", "interface", "{", "}", ",", "pointer", "string", ")", "(", "rv", "bool", ")", "{", "defer", "func", "(", ")", "{", "if", "e", ":=", "recover", "(", ")", ";", "e", "!=", "nil", "{", "rv", "=", "false", "\n", "}", "\n...
// Has return whether the obj has pointer.
[ "Has", "return", "whether", "the", "obj", "has", "pointer", "." ]
37667080efed1c5c793dc49809f8748f7c830432
https://github.com/mattn/go-jsonpointer/blob/37667080efed1c5c793dc49809f8748f7c830432/jsonpointer.go#L28-L58
137,757
mattn/go-jsonpointer
jsonpointer.go
Get
func Get(obj interface{}, pointer string) (rv interface{}, err error) { defer func() { if e := recover(); e != nil { err = fmt.Errorf("invalid JSON pointer: %q: %v", pointer, e) } }() tokens, err := parse(pointer) if err != nil { return nil, err } i := 0 v := reflect.ValueOf(obj) if len(tokens) > 0 &&...
go
func Get(obj interface{}, pointer string) (rv interface{}, err error) { defer func() { if e := recover(); e != nil { err = fmt.Errorf("invalid JSON pointer: %q: %v", pointer, e) } }() tokens, err := parse(pointer) if err != nil { return nil, err } i := 0 v := reflect.ValueOf(obj) if len(tokens) > 0 &&...
[ "func", "Get", "(", "obj", "interface", "{", "}", ",", "pointer", "string", ")", "(", "rv", "interface", "{", "}", ",", "err", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "e", ":=", "recover", "(", ")", ";", "e", "!=", "nil", "{", ...
// Get return a value which is pointed with pointer on obj.
[ "Get", "return", "a", "value", "which", "is", "pointed", "with", "pointer", "on", "obj", "." ]
37667080efed1c5c793dc49809f8748f7c830432
https://github.com/mattn/go-jsonpointer/blob/37667080efed1c5c793dc49809f8748f7c830432/jsonpointer.go#L61-L89
137,758
mattn/go-jsonpointer
jsonpointer.go
Set
func Set(obj interface{}, pointer string, value interface{}) (err error) { defer func() { if e := recover(); e != nil { err = fmt.Errorf("invalid JSON pointer: %q: %v", pointer, e) } }() tokens, err := parse(pointer) if err != nil { return err } i := 0 v := reflect.ValueOf(obj) var p reflect.Value va...
go
func Set(obj interface{}, pointer string, value interface{}) (err error) { defer func() { if e := recover(); e != nil { err = fmt.Errorf("invalid JSON pointer: %q: %v", pointer, e) } }() tokens, err := parse(pointer) if err != nil { return err } i := 0 v := reflect.ValueOf(obj) var p reflect.Value va...
[ "func", "Set", "(", "obj", "interface", "{", "}", ",", "pointer", "string", ",", "value", "interface", "{", "}", ")", "(", "err", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "e", ":=", "recover", "(", ")", ";", "e", "!=", "nil", "{...
// Set set a value which is pointed with pointer on obj.
[ "Set", "set", "a", "value", "which", "is", "pointed", "with", "pointer", "on", "obj", "." ]
37667080efed1c5c793dc49809f8748f7c830432
https://github.com/mattn/go-jsonpointer/blob/37667080efed1c5c793dc49809f8748f7c830432/jsonpointer.go#L92-L129
137,759
mattn/go-jsonpointer
jsonpointer.go
Remove
func Remove(obj interface{}, pointer string) (rv interface{}, err error) { defer func() { if e := recover(); e != nil { err = fmt.Errorf("invalid JSON pointer: %q: %v", pointer, e) } }() tokens, err := parse(pointer) if err != nil { return nil, err } i := 0 v := reflect.ValueOf(obj) var p, pp reflect....
go
func Remove(obj interface{}, pointer string) (rv interface{}, err error) { defer func() { if e := recover(); e != nil { err = fmt.Errorf("invalid JSON pointer: %q: %v", pointer, e) } }() tokens, err := parse(pointer) if err != nil { return nil, err } i := 0 v := reflect.ValueOf(obj) var p, pp reflect....
[ "func", "Remove", "(", "obj", "interface", "{", "}", ",", "pointer", "string", ")", "(", "rv", "interface", "{", "}", ",", "err", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "e", ":=", "recover", "(", ")", ";", "e", "!=", "nil", "{...
// Remove remove a value which is pointed with pointer on obj.
[ "Remove", "remove", "a", "value", "which", "is", "pointed", "with", "pointer", "on", "obj", "." ]
37667080efed1c5c793dc49809f8748f7c830432
https://github.com/mattn/go-jsonpointer/blob/37667080efed1c5c793dc49809f8748f7c830432/jsonpointer.go#L132-L193
137,760
choria-io/go-choria
choria/ssl.go
TLSConfig
func (fw *Framework) TLSConfig() (tlsc *tls.Config, err error) { return fw.security.TLSConfig() }
go
func (fw *Framework) TLSConfig() (tlsc *tls.Config, err error) { return fw.security.TLSConfig() }
[ "func", "(", "fw", "*", "Framework", ")", "TLSConfig", "(", ")", "(", "tlsc", "*", "tls", ".", "Config", ",", "err", "error", ")", "{", "return", "fw", ".", "security", ".", "TLSConfig", "(", ")", "\n", "}" ]
// TLSConfig creates a TLS configuration for use by NATS, HTTPS etc
[ "TLSConfig", "creates", "a", "TLS", "configuration", "for", "use", "by", "NATS", "HTTPS", "etc" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/ssl.go#L15-L17
137,761
choria-io/go-choria
choria/ssl.go
Enroll
func (fw *Framework) Enroll(ctx context.Context, wait time.Duration, cb func(int)) error { return fw.security.Enroll(ctx, wait, cb) }
go
func (fw *Framework) Enroll(ctx context.Context, wait time.Duration, cb func(int)) error { return fw.security.Enroll(ctx, wait, cb) }
[ "func", "(", "fw", "*", "Framework", ")", "Enroll", "(", "ctx", "context", ".", "Context", ",", "wait", "time", ".", "Duration", ",", "cb", "func", "(", "int", ")", ")", "error", "{", "return", "fw", ".", "security", ".", "Enroll", "(", "ctx", ",",...
// Enroll performs the tasks needed to join the security system, like create // a new certificate, csr etc
[ "Enroll", "performs", "the", "tasks", "needed", "to", "join", "the", "security", "system", "like", "create", "a", "new", "certificate", "csr", "etc" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/ssl.go#L21-L23
137,762
choria-io/go-choria
choria/ssl.go
ValidateSecurity
func (fw *Framework) ValidateSecurity() (errors []string, ok bool) { return fw.security.Validate() }
go
func (fw *Framework) ValidateSecurity() (errors []string, ok bool) { return fw.security.Validate() }
[ "func", "(", "fw", "*", "Framework", ")", "ValidateSecurity", "(", ")", "(", "errors", "[", "]", "string", ",", "ok", "bool", ")", "{", "return", "fw", ".", "security", ".", "Validate", "(", ")", "\n", "}" ]
// ValidateSecurity calls the security provider validation method and indicates // if all dependencies are met for secure operation
[ "ValidateSecurity", "calls", "the", "security", "provider", "validation", "method", "and", "indicates", "if", "all", "dependencies", "are", "met", "for", "secure", "operation" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/ssl.go#L27-L29
137,763
choria-io/go-choria
server/agents/server_info_source_mock.go
Metadata
func (m *MockAgent) Metadata() *Metadata { ret := m.ctrl.Call(m, "Metadata") ret0, _ := ret[0].(*Metadata) return ret0 }
go
func (m *MockAgent) Metadata() *Metadata { ret := m.ctrl.Call(m, "Metadata") ret0, _ := ret[0].(*Metadata) return ret0 }
[ "func", "(", "m", "*", "MockAgent", ")", "Metadata", "(", ")", "*", "Metadata", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "Metadata", ...
// Metadata mocks base method
[ "Metadata", "mocks", "base", "method" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L43-L47
137,764
choria-io/go-choria
server/agents/server_info_source_mock.go
Metadata
func (mr *MockAgentMockRecorder) Metadata() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Metadata", reflect.TypeOf((*MockAgent)(nil).Metadata)) }
go
func (mr *MockAgentMockRecorder) Metadata() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Metadata", reflect.TypeOf((*MockAgent)(nil).Metadata)) }
[ "func", "(", "mr", "*", "MockAgentMockRecorder", ")", "Metadata", "(", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeO...
// Metadata indicates an expected call of Metadata
[ "Metadata", "indicates", "an", "expected", "call", "of", "Metadata" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L50-L52
137,765
choria-io/go-choria
server/agents/server_info_source_mock.go
HandleMessage
func (mr *MockAgentMockRecorder) HandleMessage(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleMessage", reflect.TypeOf((*MockAgent)(nil).HandleMessage), arg0, arg1, arg2, arg3, arg4) }
go
func (mr *MockAgentMockRecorder) HandleMessage(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleMessage", reflect.TypeOf((*MockAgent)(nil).HandleMessage), arg0, arg1, arg2, arg3, arg4) }
[ "func", "(", "mr", "*", "MockAgentMockRecorder", ")", "HandleMessage", "(", "arg0", ",", "arg1", ",", "arg2", ",", "arg3", ",", "arg4", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "Recor...
// HandleMessage indicates an expected call of HandleMessage
[ "HandleMessage", "indicates", "an", "expected", "call", "of", "HandleMessage" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L72-L74
137,766
choria-io/go-choria
server/agents/server_info_source_mock.go
SetServerInfo
func (m *MockAgent) SetServerInfo(arg0 ServerInfoSource) { m.ctrl.Call(m, "SetServerInfo", arg0) }
go
func (m *MockAgent) SetServerInfo(arg0 ServerInfoSource) { m.ctrl.Call(m, "SetServerInfo", arg0) }
[ "func", "(", "m", "*", "MockAgent", ")", "SetServerInfo", "(", "arg0", "ServerInfoSource", ")", "{", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "}" ]
// SetServerInfo mocks base method
[ "SetServerInfo", "mocks", "base", "method" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L77-L79
137,767
choria-io/go-choria
server/agents/server_info_source_mock.go
NewMockServerInfoSource
func NewMockServerInfoSource(ctrl *gomock.Controller) *MockServerInfoSource { mock := &MockServerInfoSource{ctrl: ctrl} mock.recorder = &MockServerInfoSourceMockRecorder{mock} return mock }
go
func NewMockServerInfoSource(ctrl *gomock.Controller) *MockServerInfoSource { mock := &MockServerInfoSource{ctrl: ctrl} mock.recorder = &MockServerInfoSourceMockRecorder{mock} return mock }
[ "func", "NewMockServerInfoSource", "(", "ctrl", "*", "gomock", ".", "Controller", ")", "*", "MockServerInfoSource", "{", "mock", ":=", "&", "MockServerInfoSource", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockServerInfoSourceMockR...
// NewMockServerInfoSource creates a new mock instance
[ "NewMockServerInfoSource", "creates", "a", "new", "mock", "instance" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L98-L102
137,768
choria-io/go-choria
server/agents/server_info_source_mock.go
KnownAgents
func (m *MockServerInfoSource) KnownAgents() []string { ret := m.ctrl.Call(m, "KnownAgents") ret0, _ := ret[0].([]string) return ret0 }
go
func (m *MockServerInfoSource) KnownAgents() []string { ret := m.ctrl.Call(m, "KnownAgents") ret0, _ := ret[0].([]string) return ret0 }
[ "func", "(", "m", "*", "MockServerInfoSource", ")", "KnownAgents", "(", ")", "[", "]", "string", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "[...
// KnownAgents mocks base method
[ "KnownAgents", "mocks", "base", "method" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L110-L114
137,769
choria-io/go-choria
server/agents/server_info_source_mock.go
AgentMetadata
func (m *MockServerInfoSource) AgentMetadata(arg0 string) (Metadata, bool) { ret := m.ctrl.Call(m, "AgentMetadata", arg0) ret0, _ := ret[0].(Metadata) ret1, _ := ret[1].(bool) return ret0, ret1 }
go
func (m *MockServerInfoSource) AgentMetadata(arg0 string) (Metadata, bool) { ret := m.ctrl.Call(m, "AgentMetadata", arg0) ret0, _ := ret[0].(Metadata) ret1, _ := ret[1].(bool) return ret0, ret1 }
[ "func", "(", "m", "*", "MockServerInfoSource", ")", "AgentMetadata", "(", "arg0", "string", ")", "(", "Metadata", ",", "bool", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "...
// AgentMetadata mocks base method
[ "AgentMetadata", "mocks", "base", "method" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L122-L127
137,770
choria-io/go-choria
server/agents/server_info_source_mock.go
AgentMetadata
func (mr *MockServerInfoSourceMockRecorder) AgentMetadata(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AgentMetadata", reflect.TypeOf((*MockServerInfoSource)(nil).AgentMetadata), arg0) }
go
func (mr *MockServerInfoSourceMockRecorder) AgentMetadata(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AgentMetadata", reflect.TypeOf((*MockServerInfoSource)(nil).AgentMetadata), arg0) }
[ "func", "(", "mr", "*", "MockServerInfoSourceMockRecorder", ")", "AgentMetadata", "(", "arg0", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", "...
// AgentMetadata indicates an expected call of AgentMetadata
[ "AgentMetadata", "indicates", "an", "expected", "call", "of", "AgentMetadata" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L130-L132
137,771
choria-io/go-choria
server/agents/server_info_source_mock.go
Facts
func (m *MockServerInfoSource) Facts() json.RawMessage { ret := m.ctrl.Call(m, "Facts") ret0, _ := ret[0].(json.RawMessage) return ret0 }
go
func (m *MockServerInfoSource) Facts() json.RawMessage { ret := m.ctrl.Call(m, "Facts") ret0, _ := ret[0].(json.RawMessage) return ret0 }
[ "func", "(", "m", "*", "MockServerInfoSource", ")", "Facts", "(", ")", "json", ".", "RawMessage", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "...
// Facts mocks base method
[ "Facts", "mocks", "base", "method" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L159-L163
137,772
choria-io/go-choria
server/agents/server_info_source_mock.go
StartTime
func (m *MockServerInfoSource) StartTime() time.Time { ret := m.ctrl.Call(m, "StartTime") ret0, _ := ret[0].(time.Time) return ret0 }
go
func (m *MockServerInfoSource) StartTime() time.Time { ret := m.ctrl.Call(m, "StartTime") ret0, _ := ret[0].(time.Time) return ret0 }
[ "func", "(", "m", "*", "MockServerInfoSource", ")", "StartTime", "(", ")", "time", ".", "Time", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "ti...
// StartTime mocks base method
[ "StartTime", "mocks", "base", "method" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L171-L175
137,773
choria-io/go-choria
server/agents/server_info_source_mock.go
NewEvent
func (m *MockServerInfoSource) NewEvent(t go_lifecycle.Type, opts ...go_lifecycle.Option) error { varargs := []interface{}{t} for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "NewEvent", varargs...) ret0, _ := ret[0].(error) return ret0 }
go
func (m *MockServerInfoSource) NewEvent(t go_lifecycle.Type, opts ...go_lifecycle.Option) error { varargs := []interface{}{t} for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "NewEvent", varargs...) ret0, _ := ret[0].(error) return ret0 }
[ "func", "(", "m", "*", "MockServerInfoSource", ")", "NewEvent", "(", "t", "go_lifecycle", ".", "Type", ",", "opts", "...", "go_lifecycle", ".", "Option", ")", "error", "{", "varargs", ":=", "[", "]", "interface", "{", "}", "{", "t", "}", "\n", "for", ...
// NewEvent mocks base method
[ "NewEvent", "mocks", "base", "method" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L195-L203
137,774
choria-io/go-choria
server/agents/server_info_source_mock.go
NewEvent
func (mr *MockServerInfoSourceMockRecorder) NewEvent(t interface{}, opts ...interface{}) *gomock.Call { varargs := append([]interface{}{t}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewEvent", reflect.TypeOf((*MockServerInfoSource)(nil).NewEvent), varargs...) }
go
func (mr *MockServerInfoSourceMockRecorder) NewEvent(t interface{}, opts ...interface{}) *gomock.Call { varargs := append([]interface{}{t}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewEvent", reflect.TypeOf((*MockServerInfoSource)(nil).NewEvent), varargs...) }
[ "func", "(", "mr", "*", "MockServerInfoSourceMockRecorder", ")", "NewEvent", "(", "t", "interface", "{", "}", ",", "opts", "...", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "varargs", ":=", "append", "(", "[", "]", "interface", "{", "...
// NewEvent indicates an expected call of NewEvent
[ "NewEvent", "indicates", "an", "expected", "call", "of", "NewEvent" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L206-L209
137,775
choria-io/go-choria
server/agents/server_info_source_mock.go
MachinesStatus
func (m *MockServerInfoSource) MachinesStatus() ([]aagent.MachineState, error) { ret := m.ctrl.Call(m, "MachinesStatus") ret0, _ := ret[0].([]aagent.MachineState) ret1, _ := ret[1].(error) return ret0, ret1 }
go
func (m *MockServerInfoSource) MachinesStatus() ([]aagent.MachineState, error) { ret := m.ctrl.Call(m, "MachinesStatus") ret0, _ := ret[0].([]aagent.MachineState) ret1, _ := ret[1].(error) return ret0, ret1 }
[ "func", "(", "m", "*", "MockServerInfoSource", ")", "MachinesStatus", "(", ")", "(", "[", "]", "aagent", ".", "MachineState", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "...
// MachinesStatus mocks base method
[ "MachinesStatus", "mocks", "base", "method" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L212-L217
137,776
choria-io/go-choria
server/agents/server_info_source_mock.go
MachinesStatus
func (mr *MockServerInfoSourceMockRecorder) MachinesStatus() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MachinesStatus", reflect.TypeOf((*MockServerInfoSource)(nil).MachinesStatus)) }
go
func (mr *MockServerInfoSourceMockRecorder) MachinesStatus() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MachinesStatus", reflect.TypeOf((*MockServerInfoSource)(nil).MachinesStatus)) }
[ "func", "(", "mr", "*", "MockServerInfoSourceMockRecorder", ")", "MachinesStatus", "(", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect"...
// MachinesStatus indicates an expected call of MachinesStatus
[ "MachinesStatus", "indicates", "an", "expected", "call", "of", "MachinesStatus" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L220-L222
137,777
choria-io/go-choria
server/agents/server_info_source_mock.go
MachineTransition
func (m *MockServerInfoSource) MachineTransition(name, version, path, id, transition string) error { ret := m.ctrl.Call(m, "MachineTransition", name, version, path, id, transition) ret0, _ := ret[0].(error) return ret0 }
go
func (m *MockServerInfoSource) MachineTransition(name, version, path, id, transition string) error { ret := m.ctrl.Call(m, "MachineTransition", name, version, path, id, transition) ret0, _ := ret[0].(error) return ret0 }
[ "func", "(", "m", "*", "MockServerInfoSource", ")", "MachineTransition", "(", "name", ",", "version", ",", "path", ",", "id", ",", "transition", "string", ")", "error", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", ...
// MachineTransition mocks base method
[ "MachineTransition", "mocks", "base", "method" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L225-L229
137,778
choria-io/go-choria
server/agents/server_info_source_mock.go
MachineTransition
func (mr *MockServerInfoSourceMockRecorder) MachineTransition(name, version, path, id, transition interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MachineTransition", reflect.TypeOf((*MockServerInfoSource)(nil).MachineTransition), name, version, path, id, transition) }
go
func (mr *MockServerInfoSourceMockRecorder) MachineTransition(name, version, path, id, transition interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MachineTransition", reflect.TypeOf((*MockServerInfoSource)(nil).MachineTransition), name, version, path, id, transition) }
[ "func", "(", "mr", "*", "MockServerInfoSourceMockRecorder", ")", "MachineTransition", "(", "name", ",", "version", ",", "path", ",", "id", ",", "transition", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "...
// MachineTransition indicates an expected call of MachineTransition
[ "MachineTransition", "indicates", "an", "expected", "call", "of", "MachineTransition" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/server_info_source_mock.go#L232-L234
137,779
choria-io/go-choria
aagent/watchers/watcherdef.go
ParseAnnounceInterval
func (w *WatcherDef) ParseAnnounceInterval() (err error) { if w.AnnounceInterval != "" { w.announceDuration, err = time.ParseDuration(w.AnnounceInterval) if err != nil { return errors.Wrapf(err, "unknown announce interval for watcher %s", w.Name) } if w.announceDuration < time.Minute { return errors.Err...
go
func (w *WatcherDef) ParseAnnounceInterval() (err error) { if w.AnnounceInterval != "" { w.announceDuration, err = time.ParseDuration(w.AnnounceInterval) if err != nil { return errors.Wrapf(err, "unknown announce interval for watcher %s", w.Name) } if w.announceDuration < time.Minute { return errors.Err...
[ "func", "(", "w", "*", "WatcherDef", ")", "ParseAnnounceInterval", "(", ")", "(", "err", "error", ")", "{", "if", "w", ".", "AnnounceInterval", "!=", "\"", "\"", "{", "w", ".", "announceDuration", ",", "err", "=", "time", ".", "ParseDuration", "(", "w"...
// ParseAnnounceInterval parses the announce interval and ensures its not too small
[ "ParseAnnounceInterval", "parses", "the", "announce", "interval", "and", "ensures", "its", "not", "too", "small" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/aagent/watchers/watcherdef.go#L25-L38
137,780
choria-io/go-choria
config/mutators.go
RegisterMutator
func RegisterMutator(name string, m Mutator) { mu.Lock() defer mu.Unlock() mutators = append(mutators, m) mutatorNames = append(mutatorNames, name) }
go
func RegisterMutator(name string, m Mutator) { mu.Lock() defer mu.Unlock() mutators = append(mutators, m) mutatorNames = append(mutatorNames, name) }
[ "func", "RegisterMutator", "(", "name", "string", ",", "m", "Mutator", ")", "{", "mu", ".", "Lock", "(", ")", "\n", "defer", "mu", ".", "Unlock", "(", ")", "\n\n", "mutators", "=", "append", "(", "mutators", ",", "m", ")", "\n", "mutatorNames", "=", ...
// RegisterMutator registers a new configuration mutator
[ "RegisterMutator", "registers", "a", "new", "configuration", "mutator" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/config/mutators.go#L19-L25
137,781
choria-io/go-choria
config/mutators.go
Mutate
func Mutate(c *Config, log *logrus.Entry) { mu.Lock() defer mu.Unlock() for _, mutator := range mutators { mutator.Mutate(c, log) } }
go
func Mutate(c *Config, log *logrus.Entry) { mu.Lock() defer mu.Unlock() for _, mutator := range mutators { mutator.Mutate(c, log) } }
[ "func", "Mutate", "(", "c", "*", "Config", ",", "log", "*", "logrus", ".", "Entry", ")", "{", "mu", ".", "Lock", "(", ")", "\n", "defer", "mu", ".", "Unlock", "(", ")", "\n\n", "for", "_", ",", "mutator", ":=", "range", "mutators", "{", "mutator"...
// Mutate calls all registered mutators on the given configuration
[ "Mutate", "calls", "all", "registered", "mutators", "on", "the", "given", "configuration" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/config/mutators.go#L33-L40
137,782
choria-io/go-choria
server/registration/registration.go
New
func New(c *choria.Framework, conn choria.PublishableConnector, logger *logrus.Entry) *Manager { r := &Manager{ log: logger.WithFields(logrus.Fields{"subsystem": "registration"}), choria: c, cfg: c.Config, connector: conn, datac: make(chan *data.RegistrationItem, 1), } return r }
go
func New(c *choria.Framework, conn choria.PublishableConnector, logger *logrus.Entry) *Manager { r := &Manager{ log: logger.WithFields(logrus.Fields{"subsystem": "registration"}), choria: c, cfg: c.Config, connector: conn, datac: make(chan *data.RegistrationItem, 1), } return r }
[ "func", "New", "(", "c", "*", "choria", ".", "Framework", ",", "conn", "choria", ".", "PublishableConnector", ",", "logger", "*", "logrus", ".", "Entry", ")", "*", "Manager", "{", "r", ":=", "&", "Manager", "{", "log", ":", "logger", ".", "WithFields",...
// New creates a new instance of the registration subsystem manager
[ "New", "creates", "a", "new", "instance", "of", "the", "registration", "subsystem", "manager" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/registration/registration.go#L41-L51
137,783
choria-io/go-choria
server/registration/registration.go
Start
func (reg *Manager) Start(ctx context.Context, wg *sync.WaitGroup) error { defer wg.Done() if reg.cfg.RegistrationCollective == "" { reg.cfg.RegistrationCollective = reg.cfg.MainCollective } var err error var registrator Registrator for _, rtype := range reg.cfg.Registration { switch rtype { case "": ...
go
func (reg *Manager) Start(ctx context.Context, wg *sync.WaitGroup) error { defer wg.Done() if reg.cfg.RegistrationCollective == "" { reg.cfg.RegistrationCollective = reg.cfg.MainCollective } var err error var registrator Registrator for _, rtype := range reg.cfg.Registration { switch rtype { case "": ...
[ "func", "(", "reg", "*", "Manager", ")", "Start", "(", "ctx", "context", ".", "Context", ",", "wg", "*", "sync", ".", "WaitGroup", ")", "error", "{", "defer", "wg", ".", "Done", "(", ")", "\n\n", "if", "reg", ".", "cfg", ".", "RegistrationCollective"...
// Start initializes the fully managed registration plugins and start publishing // their data
[ "Start", "initializes", "the", "fully", "managed", "registration", "plugins", "and", "start", "publishing", "their", "data" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/registration/registration.go#L55-L83
137,784
choria-io/go-choria
server/registration/registration.go
RegisterProvider
func (reg *Manager) RegisterProvider(ctx context.Context, wg *sync.WaitGroup, provider RegistrationDataProvider) error { wg.Add(1) go reg.registrationWorker(ctx, wg, provider) return nil }
go
func (reg *Manager) RegisterProvider(ctx context.Context, wg *sync.WaitGroup, provider RegistrationDataProvider) error { wg.Add(1) go reg.registrationWorker(ctx, wg, provider) return nil }
[ "func", "(", "reg", "*", "Manager", ")", "RegisterProvider", "(", "ctx", "context", ".", "Context", ",", "wg", "*", "sync", ".", "WaitGroup", ",", "provider", "RegistrationDataProvider", ")", "error", "{", "wg", ".", "Add", "(", "1", ")", "\n", "go", "...
// RegisterProvider creates a publisher for a new provider
[ "RegisterProvider", "creates", "a", "publisher", "for", "a", "new", "provider" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/registration/registration.go#L86-L91
137,785
choria-io/go-choria
server/machine.go
StartMachine
func (srv *Instance) StartMachine(ctx context.Context, wg *sync.WaitGroup) (err error) { if srv.cfg.Choria.MachineSourceDir == "" { return fmt.Errorf("Choria Autonomous Agent source directory not configured, skipping initialization") } srv.machines, err = aagent.New(srv.cfg.Choria.MachineSourceDir, srv) if err !...
go
func (srv *Instance) StartMachine(ctx context.Context, wg *sync.WaitGroup) (err error) { if srv.cfg.Choria.MachineSourceDir == "" { return fmt.Errorf("Choria Autonomous Agent source directory not configured, skipping initialization") } srv.machines, err = aagent.New(srv.cfg.Choria.MachineSourceDir, srv) if err !...
[ "func", "(", "srv", "*", "Instance", ")", "StartMachine", "(", "ctx", "context", ".", "Context", ",", "wg", "*", "sync", ".", "WaitGroup", ")", "(", "err", "error", ")", "{", "if", "srv", ".", "cfg", ".", "Choria", ".", "MachineSourceDir", "==", "\""...
// StartMachine starts the choria machine instances
[ "StartMachine", "starts", "the", "choria", "machine", "instances" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/machine.go#L12-L23
137,786
choria-io/go-choria
registration/file_content.go
NewFileContent
func NewFileContent(c *config.Config, logger *logrus.Entry) (*FileContent, error) { if c.Choria.FileContentRegistrationData == "" { return nil, fmt.Errorf("File Content Registration is enabled but no source data is configured, please set plugin.choria.registration.file_content.data") } reg := &FileContent{} reg....
go
func NewFileContent(c *config.Config, logger *logrus.Entry) (*FileContent, error) { if c.Choria.FileContentRegistrationData == "" { return nil, fmt.Errorf("File Content Registration is enabled but no source data is configured, please set plugin.choria.registration.file_content.data") } reg := &FileContent{} reg....
[ "func", "NewFileContent", "(", "c", "*", "config", ".", "Config", ",", "logger", "*", "logrus", ".", "Entry", ")", "(", "*", "FileContent", ",", "error", ")", "{", "if", "c", ".", "Choria", ".", "FileContentRegistrationData", "==", "\"", "\"", "{", "re...
// NewFileContent creates a new fully managed registration plugin instance
[ "NewFileContent", "creates", "a", "new", "fully", "managed", "registration", "plugin", "instance" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/registration/file_content.go#L41-L50
137,787
choria-io/go-choria
registration/file_content.go
Init
func (fc *FileContent) Init(c *config.Config, logger *logrus.Entry) { fc.c = c fc.dataFile = c.Choria.FileContentRegistrationData fc.log = logger.WithFields(logrus.Fields{"registration": "file_content", "source": fc.dataFile}) fc.log.Infof("Configured File Content Registration with source '%s' and target '%s'", fc...
go
func (fc *FileContent) Init(c *config.Config, logger *logrus.Entry) { fc.c = c fc.dataFile = c.Choria.FileContentRegistrationData fc.log = logger.WithFields(logrus.Fields{"registration": "file_content", "source": fc.dataFile}) fc.log.Infof("Configured File Content Registration with source '%s' and target '%s'", fc...
[ "func", "(", "fc", "*", "FileContent", ")", "Init", "(", "c", "*", "config", ".", "Config", ",", "logger", "*", "logrus", ".", "Entry", ")", "{", "fc", ".", "c", "=", "c", "\n", "fc", ".", "dataFile", "=", "c", ".", "Choria", ".", "FileContentReg...
// Init sets up the plugin
[ "Init", "sets", "up", "the", "plugin" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/registration/file_content.go#L53-L59
137,788
choria-io/go-choria
registration/file_content.go
StartRegistration
func (fc *FileContent) StartRegistration(ctx context.Context, wg *sync.WaitGroup, interval int, output chan *data.RegistrationItem) { defer wg.Done() err := fc.publish(output) if err != nil { fc.log.Errorf("Could not create registration data: %s", err) } for { select { case <-time.Tick(time.Duration(interv...
go
func (fc *FileContent) StartRegistration(ctx context.Context, wg *sync.WaitGroup, interval int, output chan *data.RegistrationItem) { defer wg.Done() err := fc.publish(output) if err != nil { fc.log.Errorf("Could not create registration data: %s", err) } for { select { case <-time.Tick(time.Duration(interv...
[ "func", "(", "fc", "*", "FileContent", ")", "StartRegistration", "(", "ctx", "context", ".", "Context", ",", "wg", "*", "sync", ".", "WaitGroup", ",", "interval", "int", ",", "output", "chan", "*", "data", ".", "RegistrationItem", ")", "{", "defer", "wg"...
// StartRegistration starts stats a publishing loop
[ "StartRegistration", "starts", "stats", "a", "publishing", "loop" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/registration/file_content.go#L62-L82
137,789
choria-io/go-choria
plugin/plugin.go
Register
func Register(name string, plugin Pluggable) error { var err error switch Type(plugin.PluginType()) { case AgentProviderPlugin: err = registerAgentProviderPlugin(name, plugin) case AgentPlugin: err = registerAgentPlugin(name, plugin) case ProvisionTargetResolverPlugin: err = registerProvisionTargetResolve...
go
func Register(name string, plugin Pluggable) error { var err error switch Type(plugin.PluginType()) { case AgentProviderPlugin: err = registerAgentProviderPlugin(name, plugin) case AgentPlugin: err = registerAgentPlugin(name, plugin) case ProvisionTargetResolverPlugin: err = registerProvisionTargetResolve...
[ "func", "Register", "(", "name", "string", ",", "plugin", "Pluggable", ")", "error", "{", "var", "err", "error", "\n\n", "switch", "Type", "(", "plugin", ".", "PluginType", "(", ")", ")", "{", "case", "AgentProviderPlugin", ":", "err", "=", "registerAgentP...
// Register registers a type of plugin into the choria server
[ "Register", "registers", "a", "type", "of", "plugin", "into", "the", "choria", "server" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/plugin/plugin.go#L62-L83
137,790
choria-io/go-choria
plugin/plugin.go
Load
func Load(file string) (*List, error) { rawdat := make(map[string]string) input, err := ioutil.ReadFile(file) if err != nil { return nil, err } err = yaml.Unmarshal(input, &rawdat) if err != nil { return nil, fmt.Errorf("could not parse yaml: %s", err) } list := &List{Plugins: []*Plugin{}} for k, v := ra...
go
func Load(file string) (*List, error) { rawdat := make(map[string]string) input, err := ioutil.ReadFile(file) if err != nil { return nil, err } err = yaml.Unmarshal(input, &rawdat) if err != nil { return nil, fmt.Errorf("could not parse yaml: %s", err) } list := &List{Plugins: []*Plugin{}} for k, v := ra...
[ "func", "Load", "(", "file", "string", ")", "(", "*", "List", ",", "error", ")", "{", "rawdat", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "input", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "file", ")", "\n", "if",...
// Load loads a plugin list from file
[ "Load", "loads", "a", "plugin", "list", "from", "file" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/plugin/plugin.go#L86-L104
137,791
choria-io/go-choria
plugin/plugin.go
Loader
func (p *Plugin) Loader() (string, error) { templ := template.Must(template.New("provider").Parse(ftempl)) var b bytes.Buffer writer := bufio.NewWriter(&b) err := templ.Execute(writer, p) writer.Flush() return string(b.Bytes()), err }
go
func (p *Plugin) Loader() (string, error) { templ := template.Must(template.New("provider").Parse(ftempl)) var b bytes.Buffer writer := bufio.NewWriter(&b) err := templ.Execute(writer, p) writer.Flush() return string(b.Bytes()), err }
[ "func", "(", "p", "*", "Plugin", ")", "Loader", "(", ")", "(", "string", ",", "error", ")", "{", "templ", ":=", "template", ".", "Must", "(", "template", ".", "New", "(", "\"", "\"", ")", ".", "Parse", "(", "ftempl", ")", ")", "\n\n", "var", "b...
// Loader is the loader go code
[ "Loader", "is", "the", "loader", "go", "code" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/plugin/plugin.go#L112-L122
137,792
choria-io/go-choria
puppet/puppet.go
FacterStringFact
func FacterStringFact(fact string) (string, error) { mu.Lock() defer mu.Unlock() value, ok := cache[fact] if ok { return value, nil } cmd := FacterCmd() if cmd == "" { return "", errors.New("could not find your facter command") } out, err := exec.Command(cmd, fact).Output() if err != nil { return ""...
go
func FacterStringFact(fact string) (string, error) { mu.Lock() defer mu.Unlock() value, ok := cache[fact] if ok { return value, nil } cmd := FacterCmd() if cmd == "" { return "", errors.New("could not find your facter command") } out, err := exec.Command(cmd, fact).Output() if err != nil { return ""...
[ "func", "FacterStringFact", "(", "fact", "string", ")", "(", "string", ",", "error", ")", "{", "mu", ".", "Lock", "(", ")", "\n", "defer", "mu", ".", "Unlock", "(", ")", "\n\n", "value", ",", "ok", ":=", "cache", "[", "fact", "]", "\n", "if", "ok...
// FacterStringFact looks up a facter fact, returns "" when unknown
[ "FacterStringFact", "looks", "up", "a", "facter", "fact", "returns", "when", "unknown" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/puppet/puppet.go#L18-L42
137,793
choria-io/go-choria
puppet/puppet.go
AIOCmd
func AIOCmd(command string, def string) string { aioPath := filepath.Join("/opt/puppetlabs/bin", command) if runtime.GOOS == "windows" { aioPath = filepath.FromSlash(filepath.Join("C:/Program Files/Puppet Labs/Puppet/bin", fmt.Sprintf("%s.bat", command))) } if _, err := os.Stat(aioPath); err == nil { return a...
go
func AIOCmd(command string, def string) string { aioPath := filepath.Join("/opt/puppetlabs/bin", command) if runtime.GOOS == "windows" { aioPath = filepath.FromSlash(filepath.Join("C:/Program Files/Puppet Labs/Puppet/bin", fmt.Sprintf("%s.bat", command))) } if _, err := os.Stat(aioPath); err == nil { return a...
[ "func", "AIOCmd", "(", "command", "string", ",", "def", "string", ")", "string", "{", "aioPath", ":=", "filepath", ".", "Join", "(", "\"", "\"", ",", "command", ")", "\n\n", "if", "runtime", ".", "GOOS", "==", "\"", "\"", "{", "aioPath", "=", "filepa...
// AIOCmd looks up a command in the AIO paths, if it's not there // it will try PATH and finally return a default if not in PATH
[ "AIOCmd", "looks", "up", "a", "command", "in", "the", "AIO", "paths", "if", "it", "s", "not", "there", "it", "will", "try", "PATH", "and", "finally", "return", "a", "default", "if", "not", "in", "PATH" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/puppet/puppet.go#L61-L78
137,794
choria-io/go-choria
choria/framework.go
New
func New(path string) (*Framework, error) { conf, err := config.NewConfig(path) if err != nil { return nil, err } return NewWithConfig(conf) }
go
func New(path string) (*Framework, error) { conf, err := config.NewConfig(path) if err != nil { return nil, err } return NewWithConfig(conf) }
[ "func", "New", "(", "path", "string", ")", "(", "*", "Framework", ",", "error", ")", "{", "conf", ",", "err", ":=", "config", ".", "NewConfig", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n",...
// New sets up a Choria with all its config loaded and so forth
[ "New", "sets", "up", "a", "Choria", "with", "all", "its", "config", "loaded", "and", "so", "forth" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L40-L47
137,795
choria-io/go-choria
choria/framework.go
NewWithConfig
func NewWithConfig(cfg *config.Config) (*Framework, error) { c := Framework{ Config: cfg, mu: &sync.Mutex{}, } if c.ProvisionMode() { c.ConfigureProvisioning() } err := c.SetupLogging(false) if err != nil { return &c, fmt.Errorf("could not set up logging: %s", err) } err = c.setupSecurity() if e...
go
func NewWithConfig(cfg *config.Config) (*Framework, error) { c := Framework{ Config: cfg, mu: &sync.Mutex{}, } if c.ProvisionMode() { c.ConfigureProvisioning() } err := c.SetupLogging(false) if err != nil { return &c, fmt.Errorf("could not set up logging: %s", err) } err = c.setupSecurity() if e...
[ "func", "NewWithConfig", "(", "cfg", "*", "config", ".", "Config", ")", "(", "*", "Framework", ",", "error", ")", "{", "c", ":=", "Framework", "{", "Config", ":", "cfg", ",", "mu", ":", "&", "sync", ".", "Mutex", "{", "}", ",", "}", "\n\n", "if",...
// NewWithConfig creates a new instance of the framework with the supplied config instance
[ "NewWithConfig", "creates", "a", "new", "instance", "of", "the", "framework", "with", "the", "supplied", "config", "instance" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L50-L73
137,796
choria-io/go-choria
choria/framework.go
ProvisionMode
func (fw *Framework) ProvisionMode() bool { if !fw.Config.InitiatedByServer || build.ProvisionBrokerURLs == "" { return false } if fw.Config.HasOption("plugin.choria.server.provision") { return fw.Config.Choria.Provision } return build.ProvisionDefault() }
go
func (fw *Framework) ProvisionMode() bool { if !fw.Config.InitiatedByServer || build.ProvisionBrokerURLs == "" { return false } if fw.Config.HasOption("plugin.choria.server.provision") { return fw.Config.Choria.Provision } return build.ProvisionDefault() }
[ "func", "(", "fw", "*", "Framework", ")", "ProvisionMode", "(", ")", "bool", "{", "if", "!", "fw", ".", "Config", ".", "InitiatedByServer", "||", "build", ".", "ProvisionBrokerURLs", "==", "\"", "\"", "{", "return", "false", "\n", "}", "\n\n", "if", "f...
// ProvisionMode determines if this instance is in provisioning mode // if the setting `plugin.choria.server.provision` is set at all then // the value of that is returned, else it the build time property // ProvisionDefault is consulted
[ "ProvisionMode", "determines", "if", "this", "instance", "is", "in", "provisioning", "mode", "if", "the", "setting", "plugin", ".", "choria", ".", "server", ".", "provision", "is", "set", "at", "all", "then", "the", "value", "of", "that", "is", "returned", ...
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L105-L115
137,797
choria-io/go-choria
choria/framework.go
ConfigureProvisioning
func (fw *Framework) ConfigureProvisioning() { fw.Config.Choria.FederationCollectives = []string{} fw.Config.Collectives = []string{"provisioning"} fw.Config.MainCollective = "provisioning" fw.Config.Registration = []string{} fw.Config.FactSourceFile = build.ProvisionFacts if build.ProvisionStatusFile != "" { ...
go
func (fw *Framework) ConfigureProvisioning() { fw.Config.Choria.FederationCollectives = []string{} fw.Config.Collectives = []string{"provisioning"} fw.Config.MainCollective = "provisioning" fw.Config.Registration = []string{} fw.Config.FactSourceFile = build.ProvisionFacts if build.ProvisionStatusFile != "" { ...
[ "func", "(", "fw", "*", "Framework", ")", "ConfigureProvisioning", "(", ")", "{", "fw", ".", "Config", ".", "Choria", ".", "FederationCollectives", "=", "[", "]", "string", "{", "}", "\n", "fw", ".", "Config", ".", "Collectives", "=", "[", "]", "string...
// ConfigureProvisioning adjusts the active configuration to match the // provisioning profile
[ "ConfigureProvisioning", "adjusts", "the", "active", "configuration", "to", "match", "the", "provisioning", "profile" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L119-L145
137,798
choria-io/go-choria
choria/framework.go
IsFederated
func (fw *Framework) IsFederated() (result bool) { if len(fw.FederationCollectives()) == 0 { return false } return true }
go
func (fw *Framework) IsFederated() (result bool) { if len(fw.FederationCollectives()) == 0 { return false } return true }
[ "func", "(", "fw", "*", "Framework", ")", "IsFederated", "(", ")", "(", "result", "bool", ")", "{", "if", "len", "(", "fw", ".", "FederationCollectives", "(", ")", ")", "==", "0", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "...
// IsFederated determiens if the configuration is setting up any Federation collectives
[ "IsFederated", "determiens", "if", "the", "configuration", "is", "setting", "up", "any", "Federation", "collectives" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L148-L154
137,799
choria-io/go-choria
choria/framework.go
Logger
func (fw *Framework) Logger(component string) *log.Entry { return fw.log.WithFields(log.Fields{"component": component}) }
go
func (fw *Framework) Logger(component string) *log.Entry { return fw.log.WithFields(log.Fields{"component": component}) }
[ "func", "(", "fw", "*", "Framework", ")", "Logger", "(", "component", "string", ")", "*", "log", ".", "Entry", "{", "return", "fw", ".", "log", ".", "WithFields", "(", "log", ".", "Fields", "{", "\"", "\"", ":", "component", "}", ")", "\n", "}" ]
// Logger creates a new logrus entry
[ "Logger", "creates", "a", "new", "logrus", "entry" ]
2c773ed36498f426852fd294ebb832c6a2625eba
https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L157-L159