repo stringlengths 5 67 | path stringlengths 4 218 | func_name stringlengths 0 151 | original_string stringlengths 52 373k | language stringclasses 6
values | code stringlengths 52 373k | code_tokens listlengths 10 512 | docstring stringlengths 3 47.2k | docstring_tokens listlengths 3 234 | sha stringlengths 40 40 | url stringlengths 85 339 | partition stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
DamienFontaine/lunarc | security/controller.go | Refresh | func (c *OAuth2Controller) Refresh(w http.ResponseWriter, r *http.Request) {
grantType := r.URL.Query().Get("grant_type")
refreshToken := r.URL.Query().Get("refresh_token")
if strings.Compare(grantType, "refresh_token") != 0 {
http.Error(w, errors.New("Parameter grant_type is required").Error(), http.StatusBadRequ... | go | func (c *OAuth2Controller) Refresh(w http.ResponseWriter, r *http.Request) {
grantType := r.URL.Query().Get("grant_type")
refreshToken := r.URL.Query().Get("refresh_token")
if strings.Compare(grantType, "refresh_token") != 0 {
http.Error(w, errors.New("Parameter grant_type is required").Error(), http.StatusBadRequ... | [
"func",
"(",
"c",
"*",
"OAuth2Controller",
")",
"Refresh",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"grantType",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"grant_type\"",
")",
... | //Refresh returns a new access token | [
"Refresh",
"returns",
"a",
"new",
"access",
"token"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/security/controller.go#L84-L115 | test |
DamienFontaine/lunarc | security/controller.go | Token | func (c *OAuth2Controller) Token(w http.ResponseWriter, r *http.Request) {
grantType := r.URL.Query().Get("grant_type")
code := r.URL.Query().Get("code")
if strings.Compare(grantType, "authorization_code") != 0 {
http.Error(w, errors.New("Parameter grant_type is required").Error(), http.StatusBadRequest)
return
... | go | func (c *OAuth2Controller) Token(w http.ResponseWriter, r *http.Request) {
grantType := r.URL.Query().Get("grant_type")
code := r.URL.Query().Get("code")
if strings.Compare(grantType, "authorization_code") != 0 {
http.Error(w, errors.New("Parameter grant_type is required").Error(), http.StatusBadRequest)
return
... | [
"func",
"(",
"c",
"*",
"OAuth2Controller",
")",
"Token",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"grantType",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"grant_type\"",
")",
"... | //Token returns a new access token | [
"Token",
"returns",
"a",
"new",
"access",
"token"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/security/controller.go#L118-L157 | test |
DamienFontaine/lunarc | web/handlers.go | Logging | func Logging(next http.Handler, log *logrus.Logger) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
srw := StatusResponseWriter{w, 0, 0}
start := time.Now()
next.ServeHTTP(&srw, r)
end := time.Now()
latency := end.Sub(start)
log.WithField("client", r.RemoteAddr).WithF... | go | func Logging(next http.Handler, log *logrus.Logger) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
srw := StatusResponseWriter{w, 0, 0}
start := time.Now()
next.ServeHTTP(&srw, r)
end := time.Now()
latency := end.Sub(start)
log.WithField("client", r.RemoteAddr).WithF... | [
"func",
"Logging",
"(",
"next",
"http",
".",
"Handler",
",",
"log",
"*",
"logrus",
".",
"Logger",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
"."... | //Logging logs http requests | [
"Logging",
"logs",
"http",
"requests"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/web/handlers.go#L29-L39 | test |
DamienFontaine/lunarc | web/handlers.go | SingleFile | func SingleFile(filename string) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, filename)
})
} | go | func SingleFile(filename string) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, filename)
})
} | [
"func",
"SingleFile",
"(",
"filename",
"string",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"http",
".",
"ServeFile",
"(... | //SingleFile returns a handler | [
"SingleFile",
"returns",
"a",
"handler"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/web/handlers.go#L42-L46 | test |
DamienFontaine/lunarc | web/handlers.go | Write | func (w *StatusResponseWriter) Write(data []byte) (int, error) {
w.length = len(data)
return w.ResponseWriter.Write(data)
} | go | func (w *StatusResponseWriter) Write(data []byte) (int, error) {
w.length = len(data)
return w.ResponseWriter.Write(data)
} | [
"func",
"(",
"w",
"*",
"StatusResponseWriter",
")",
"Write",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"w",
".",
"length",
"=",
"len",
"(",
"data",
")",
"\n",
"return",
"w",
".",
"ResponseWriter",
".",
"Write",
"(",
... | // Write Satisfy the http.ResponseWriter interface | [
"Write",
"Satisfy",
"the",
"http",
".",
"ResponseWriter",
"interface"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/web/handlers.go#L71-L74 | test |
DamienFontaine/lunarc | web/handlers.go | Hijack | func (w *StatusResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
if hj, ok := w.ResponseWriter.(http.Hijacker); ok {
return hj.Hijack()
}
return nil, nil, errors.New("Not a Hijacker")
} | go | func (w *StatusResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
if hj, ok := w.ResponseWriter.(http.Hijacker); ok {
return hj.Hijack()
}
return nil, nil, errors.New("Not a Hijacker")
} | [
"func",
"(",
"w",
"*",
"StatusResponseWriter",
")",
"Hijack",
"(",
")",
"(",
"net",
".",
"Conn",
",",
"*",
"bufio",
".",
"ReadWriter",
",",
"error",
")",
"{",
"if",
"hj",
",",
"ok",
":=",
"w",
".",
"ResponseWriter",
".",
"(",
"http",
".",
"Hijacker... | //Hijack Satisfy the http.ResponseWriter interface | [
"Hijack",
"Satisfy",
"the",
"http",
".",
"ResponseWriter",
"interface"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/web/handlers.go#L77-L82 | test |
DamienFontaine/lunarc | datasource/mongo/mongo.go | NewMongo | func NewMongo(filename string, environment string) (*Mongo, error) {
ctx := context.Background()
cnf, err := GetMongo(filename, environment)
if err != nil {
return nil, err
}
var uri string
if len(cnf.Username) > 0 && len(cnf.Password) > 0 {
uri = fmt.Sprintf(`mongodb://%s:%s@%s:%d/%s`,
cnf.Username,
cn... | go | func NewMongo(filename string, environment string) (*Mongo, error) {
ctx := context.Background()
cnf, err := GetMongo(filename, environment)
if err != nil {
return nil, err
}
var uri string
if len(cnf.Username) > 0 && len(cnf.Password) > 0 {
uri = fmt.Sprintf(`mongodb://%s:%s@%s:%d/%s`,
cnf.Username,
cn... | [
"func",
"NewMongo",
"(",
"filename",
"string",
",",
"environment",
"string",
")",
"(",
"*",
"Mongo",
",",
"error",
")",
"{",
"ctx",
":=",
"context",
".",
"Background",
"(",
")",
"\n",
"cnf",
",",
"err",
":=",
"GetMongo",
"(",
"filename",
",",
"environm... | //NewMongo creates a newinstance of Mongo | [
"NewMongo",
"creates",
"a",
"newinstance",
"of",
"Mongo"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/datasource/mongo/mongo.go#L34-L75 | test |
DamienFontaine/lunarc | datasource/mongo/mongo.go | Disconnect | func (m *Mongo) Disconnect() error {
err := m.Client.Disconnect(m.context)
if err != nil {
log.Printf("Impossible de fermer la connexion")
return err
}
return nil
} | go | func (m *Mongo) Disconnect() error {
err := m.Client.Disconnect(m.context)
if err != nil {
log.Printf("Impossible de fermer la connexion")
return err
}
return nil
} | [
"func",
"(",
"m",
"*",
"Mongo",
")",
"Disconnect",
"(",
")",
"error",
"{",
"err",
":=",
"m",
".",
"Client",
".",
"Disconnect",
"(",
"m",
".",
"context",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"Impossible de fermer la c... | //Disconnect a Mongo client | [
"Disconnect",
"a",
"Mongo",
"client"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/datasource/mongo/mongo.go#L78-L85 | test |
malice-plugins/go-plugin-utils | clitable/table.go | New | func New(fields []string) *Table {
return &Table{
Fields: fields,
Rows: make([]map[string]string, 0),
fieldSizes: make(map[string]int),
}
} | go | func New(fields []string) *Table {
return &Table{
Fields: fields,
Rows: make([]map[string]string, 0),
fieldSizes: make(map[string]int),
}
} | [
"func",
"New",
"(",
"fields",
"[",
"]",
"string",
")",
"*",
"Table",
"{",
"return",
"&",
"Table",
"{",
"Fields",
":",
"fields",
",",
"Rows",
":",
"make",
"(",
"[",
"]",
"map",
"[",
"string",
"]",
"string",
",",
"0",
")",
",",
"fieldSizes",
":",
... | // New - Creates a new table. | [
"New",
"-",
"Creates",
"a",
"new",
"table",
"."
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/clitable/table.go#L48-L54 | test |
malice-plugins/go-plugin-utils | clitable/table.go | PrintTable | func PrintTable(fields []string, rows []map[string]interface{}) {
table := New(fields)
for _, r := range rows {
table.AddRow(r)
}
table.Print()
} | go | func PrintTable(fields []string, rows []map[string]interface{}) {
table := New(fields)
for _, r := range rows {
table.AddRow(r)
}
table.Print()
} | [
"func",
"PrintTable",
"(",
"fields",
"[",
"]",
"string",
",",
"rows",
"[",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"table",
":=",
"New",
"(",
"fields",
")",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"rows",
"{",
"table",... | // PrintTable - Prints table. | [
"PrintTable",
"-",
"Prints",
"table",
"."
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/clitable/table.go#L57-L63 | test |
malice-plugins/go-plugin-utils | clitable/table.go | PrintHorizontal | func PrintHorizontal(m map[string]interface{}) {
table := New([]string{"Key", "Value"})
rows := mapToRows(m)
for _, row := range rows {
table.AddRow(row)
}
table.HideHead = true
table.Print()
} | go | func PrintHorizontal(m map[string]interface{}) {
table := New([]string{"Key", "Value"})
rows := mapToRows(m)
for _, row := range rows {
table.AddRow(row)
}
table.HideHead = true
table.Print()
} | [
"func",
"PrintHorizontal",
"(",
"m",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"table",
":=",
"New",
"(",
"[",
"]",
"string",
"{",
"\"Key\"",
",",
"\"Value\"",
"}",
")",
"\n",
"rows",
":=",
"mapToRows",
"(",
"m",
")",
"\n",
"for",... | // PrintHorizontal - Prints horizontal table from a map. | [
"PrintHorizontal",
"-",
"Prints",
"horizontal",
"table",
"from",
"a",
"map",
"."
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/clitable/table.go#L66-L74 | test |
malice-plugins/go-plugin-utils | clitable/table.go | PrintRow | func PrintRow(fields []string, row map[string]interface{}) {
table := New(fields)
table.AddRow(row)
table.Print()
} | go | func PrintRow(fields []string, row map[string]interface{}) {
table := New(fields)
table.AddRow(row)
table.Print()
} | [
"func",
"PrintRow",
"(",
"fields",
"[",
"]",
"string",
",",
"row",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"table",
":=",
"New",
"(",
"fields",
")",
"\n",
"table",
".",
"AddRow",
"(",
"row",
")",
"\n",
"table",
".",
"Print",
"... | // PrintRow - Prints table with only one row. | [
"PrintRow",
"-",
"Prints",
"table",
"with",
"only",
"one",
"row",
"."
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/clitable/table.go#L77-L81 | test |
malice-plugins/go-plugin-utils | clitable/table.go | AddRow | func (t *Table) AddRow(row map[string]interface{}) {
newRow := make(map[string]string)
for _, k := range t.Fields {
v := row[k]
// If is not nil format
// else value is empty string
var val string
if v == nil {
val = ""
} else {
val = fmt.Sprintf("%v", v)
}
newRow[k] = val
}
t.calculateSizes... | go | func (t *Table) AddRow(row map[string]interface{}) {
newRow := make(map[string]string)
for _, k := range t.Fields {
v := row[k]
// If is not nil format
// else value is empty string
var val string
if v == nil {
val = ""
} else {
val = fmt.Sprintf("%v", v)
}
newRow[k] = val
}
t.calculateSizes... | [
"func",
"(",
"t",
"*",
"Table",
")",
"AddRow",
"(",
"row",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"newRow",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"k",
":=",
"range",
"t",
".",
... | // AddRow - Adds row to the table. | [
"AddRow",
"-",
"Adds",
"row",
"to",
"the",
"table",
"."
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/clitable/table.go#L84-L105 | test |
malice-plugins/go-plugin-utils | clitable/table.go | Print | func (t *Table) Print() {
if len(t.Rows) == 0 && t.Footer == nil {
return
}
t.calculateSizes(t.Footer)
if !t.Markdown {
t.printDash()
}
if !t.HideHead {
fmt.Println(t.getHead())
t.printTableDash()
}
for _, r := range t.Rows {
fmt.Println(t.rowString(r))
if !t.Markdown {
t.printDash()
}
}
... | go | func (t *Table) Print() {
if len(t.Rows) == 0 && t.Footer == nil {
return
}
t.calculateSizes(t.Footer)
if !t.Markdown {
t.printDash()
}
if !t.HideHead {
fmt.Println(t.getHead())
t.printTableDash()
}
for _, r := range t.Rows {
fmt.Println(t.rowString(r))
if !t.Markdown {
t.printDash()
}
}
... | [
"func",
"(",
"t",
"*",
"Table",
")",
"Print",
"(",
")",
"{",
"if",
"len",
"(",
"t",
".",
"Rows",
")",
"==",
"0",
"&&",
"t",
".",
"Footer",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"t",
".",
"calculateSizes",
"(",
"t",
".",
"Footer",
")",
... | // Print - Prints table. | [
"Print",
"-",
"Prints",
"table",
"."
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/clitable/table.go#L113-L143 | test |
malice-plugins/go-plugin-utils | clitable/table.go | String | func (t *Table) String(title string) string {
tableString := []string{}
if len(t.Rows) == 0 && t.Footer == nil {
return ""
}
tableString = append(tableString, "### "+title)
t.calculateSizes(t.Footer)
if !t.Markdown {
// t.printDash()
tableString = append(tableString, t.stringDash())
}
if !t.HideHead... | go | func (t *Table) String(title string) string {
tableString := []string{}
if len(t.Rows) == 0 && t.Footer == nil {
return ""
}
tableString = append(tableString, "### "+title)
t.calculateSizes(t.Footer)
if !t.Markdown {
// t.printDash()
tableString = append(tableString, t.stringDash())
}
if !t.HideHead... | [
"func",
"(",
"t",
"*",
"Table",
")",
"String",
"(",
"title",
"string",
")",
"string",
"{",
"tableString",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"if",
"len",
"(",
"t",
".",
"Rows",
")",
"==",
"0",
"&&",
"t",
".",
"Footer",
"==",
"nil",
"{",
... | // String - Ouput table as a string. | [
"String",
"-",
"Ouput",
"table",
"as",
"a",
"string",
"."
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/clitable/table.go#L146-L187 | test |
malice-plugins/go-plugin-utils | clitable/table.go | getHead | func (t *Table) getHead() string {
s := "|"
for _, name := range t.Fields {
s += t.fieldString(name, strings.Title(name)) + "|"
}
return s
} | go | func (t *Table) getHead() string {
s := "|"
for _, name := range t.Fields {
s += t.fieldString(name, strings.Title(name)) + "|"
}
return s
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"getHead",
"(",
")",
"string",
"{",
"s",
":=",
"\"|\"",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"t",
".",
"Fields",
"{",
"s",
"+=",
"t",
".",
"fieldString",
"(",
"name",
",",
"strings",
".",
"Title",
"... | // getHead - Returns table header containing fields names. | [
"getHead",
"-",
"Returns",
"table",
"header",
"containing",
"fields",
"names",
"."
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/clitable/table.go#L190-L196 | test |
malice-plugins/go-plugin-utils | clitable/table.go | rowString | func (t *Table) rowString(row map[string]string) string {
s := "|"
for _, name := range t.Fields {
value := row[name]
s += t.fieldString(name, value) + "|"
}
return s
} | go | func (t *Table) rowString(row map[string]string) string {
s := "|"
for _, name := range t.Fields {
value := row[name]
s += t.fieldString(name, value) + "|"
}
return s
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"rowString",
"(",
"row",
"map",
"[",
"string",
"]",
"string",
")",
"string",
"{",
"s",
":=",
"\"|\"",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"t",
".",
"Fields",
"{",
"value",
":=",
"row",
"[",
"name",
... | // rowString - Creates a string row. | [
"rowString",
"-",
"Creates",
"a",
"string",
"row",
"."
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/clitable/table.go#L199-L206 | test |
malice-plugins/go-plugin-utils | clitable/table.go | fieldString | func (t *Table) fieldString(name, value string) string {
value = fmt.Sprintf(" %s ", value)
spacesLeft := t.fieldSizes[name] - runewidth.StringWidth(value)
if spacesLeft > 0 {
for i := 0; i < spacesLeft; i++ {
value += " "
}
}
return value
} | go | func (t *Table) fieldString(name, value string) string {
value = fmt.Sprintf(" %s ", value)
spacesLeft := t.fieldSizes[name] - runewidth.StringWidth(value)
if spacesLeft > 0 {
for i := 0; i < spacesLeft; i++ {
value += " "
}
}
return value
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"fieldString",
"(",
"name",
",",
"value",
"string",
")",
"string",
"{",
"value",
"=",
"fmt",
".",
"Sprintf",
"(",
"\" %s \"",
",",
"value",
")",
"\n",
"spacesLeft",
":=",
"t",
".",
"fieldSizes",
"[",
"name",
"]",
... | // fieldString - Creates field value string. | [
"fieldString",
"-",
"Creates",
"field",
"value",
"string",
"."
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/clitable/table.go#L209-L218 | test |
malice-plugins/go-plugin-utils | clitable/table.go | stringTableDash | func (t *Table) stringTableDash() string {
if t.Markdown {
return t.stringMarkdownDash()
}
return t.stringDash()
} | go | func (t *Table) stringTableDash() string {
if t.Markdown {
return t.stringMarkdownDash()
}
return t.stringDash()
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"stringTableDash",
"(",
")",
"string",
"{",
"if",
"t",
".",
"Markdown",
"{",
"return",
"t",
".",
"stringMarkdownDash",
"(",
")",
"\n",
"}",
"\n",
"return",
"t",
".",
"stringDash",
"(",
")",
"\n",
"}"
] | // stringTableDash - output table dash. Markdown or not depending on settings. | [
"stringTableDash",
"-",
"output",
"table",
"dash",
".",
"Markdown",
"or",
"not",
"depending",
"on",
"settings",
"."
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/clitable/table.go#L230-L235 | test |
malice-plugins/go-plugin-utils | clitable/table.go | printMarkdownDash | func (t *Table) printMarkdownDash() {
r := make(map[string]string)
for _, name := range t.Fields {
r[name] = strings.Repeat("-", t.fieldSizes[name]-2)
}
fmt.Println(t.rowString(r))
} | go | func (t *Table) printMarkdownDash() {
r := make(map[string]string)
for _, name := range t.Fields {
r[name] = strings.Repeat("-", t.fieldSizes[name]-2)
}
fmt.Println(t.rowString(r))
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"printMarkdownDash",
"(",
")",
"{",
"r",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"t",
".",
"Fields",
"{",
"r",
"[",
"name",
"]",
"=",
"strin... | // printMarkdownDash - Prints dash in middle of table. | [
"printMarkdownDash",
"-",
"Prints",
"dash",
"in",
"middle",
"of",
"table",
"."
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/clitable/table.go#L258-L264 | test |
malice-plugins/go-plugin-utils | clitable/table.go | stringMarkdownDash | func (t *Table) stringMarkdownDash() string {
r := make(map[string]string)
for _, name := range t.Fields {
r[name] = strings.Repeat("-", t.fieldSizes[name]-2)
}
return t.rowString(r)
} | go | func (t *Table) stringMarkdownDash() string {
r := make(map[string]string)
for _, name := range t.Fields {
r[name] = strings.Repeat("-", t.fieldSizes[name]-2)
}
return t.rowString(r)
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"stringMarkdownDash",
"(",
")",
"string",
"{",
"r",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"t",
".",
"Fields",
"{",
"r",
"[",
"name",
"]",
... | // stringMarkdownDash - output dash in middle of table. | [
"stringMarkdownDash",
"-",
"output",
"dash",
"in",
"middle",
"of",
"table",
"."
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/clitable/table.go#L267-L273 | test |
DamienFontaine/lunarc | security/utils.go | HashPassword | func HashPassword(password []byte, salt []byte) (hash []byte, err error) {
hash, err = scrypt.Key(password, salt, N, R, P, KEYLENGTH)
if err != nil {
return nil, err
}
return
} | go | func HashPassword(password []byte, salt []byte) (hash []byte, err error) {
hash, err = scrypt.Key(password, salt, N, R, P, KEYLENGTH)
if err != nil {
return nil, err
}
return
} | [
"func",
"HashPassword",
"(",
"password",
"[",
"]",
"byte",
",",
"salt",
"[",
"]",
"byte",
")",
"(",
"hash",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"hash",
",",
"err",
"=",
"scrypt",
".",
"Key",
"(",
"password",
",",
"salt",
",",
"N",
... | //HashPassword hash un mot de passe | [
"HashPassword",
"hash",
"un",
"mot",
"de",
"passe"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/security/utils.go#L41-L47 | test |
DamienFontaine/lunarc | security/utils.go | EncodeOAuth2Code | func EncodeOAuth2Code(clientID, redirectURI, userID, sharedKey string) (code string, err error) {
rand := RandStringBytesMaskImprSrc(20)
exp := time.Now().Add(time.Minute * 10).String()
response := NewResponse(clientID, redirectURI, userID, exp, rand)
jresponse, err := json.Marshal(response)
if err != nil {
log.... | go | func EncodeOAuth2Code(clientID, redirectURI, userID, sharedKey string) (code string, err error) {
rand := RandStringBytesMaskImprSrc(20)
exp := time.Now().Add(time.Minute * 10).String()
response := NewResponse(clientID, redirectURI, userID, exp, rand)
jresponse, err := json.Marshal(response)
if err != nil {
log.... | [
"func",
"EncodeOAuth2Code",
"(",
"clientID",
",",
"redirectURI",
",",
"userID",
",",
"sharedKey",
"string",
")",
"(",
"code",
"string",
",",
"err",
"error",
")",
"{",
"rand",
":=",
"RandStringBytesMaskImprSrc",
"(",
"20",
")",
"\n",
"exp",
":=",
"time",
".... | //EncodeOAuth2Code generate an OAuth2 code | [
"EncodeOAuth2Code",
"generate",
"an",
"OAuth2",
"code"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/security/utils.go#L95-L114 | test |
DamienFontaine/lunarc | security/utils.go | DecodeOAuth2Code | func DecodeOAuth2Code(code, sharedKey string) (response Response, err error) {
object, err := jose.ParseSigned(code)
if err != nil {
return
}
output, err := object.Verify([]byte(sharedKey))
if err != nil {
return
}
base64Text := make([]byte, base64.StdEncoding.DecodedLen(len(output)))
l, err := base64.StdEn... | go | func DecodeOAuth2Code(code, sharedKey string) (response Response, err error) {
object, err := jose.ParseSigned(code)
if err != nil {
return
}
output, err := object.Verify([]byte(sharedKey))
if err != nil {
return
}
base64Text := make([]byte, base64.StdEncoding.DecodedLen(len(output)))
l, err := base64.StdEn... | [
"func",
"DecodeOAuth2Code",
"(",
"code",
",",
"sharedKey",
"string",
")",
"(",
"response",
"Response",
",",
"err",
"error",
")",
"{",
"object",
",",
"err",
":=",
"jose",
".",
"ParseSigned",
"(",
"code",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return... | //DecodeOAuth2Code inverse of EncodeOAuth2Code | [
"DecodeOAuth2Code",
"inverse",
"of",
"EncodeOAuth2Code"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/security/utils.go#L117-L134 | test |
DamienFontaine/lunarc | web/server.go | NewServer | func NewServer(filename string, environment string) (server *Server, err error) {
conf, err := GetConfig(filename, environment)
logFile, err := os.OpenFile(conf.Log.File+logFilename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.SetOutput(os.Stderr)
log.Warningf("Can't open logfile: %v", err)
... | go | func NewServer(filename string, environment string) (server *Server, err error) {
conf, err := GetConfig(filename, environment)
logFile, err := os.OpenFile(conf.Log.File+logFilename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.SetOutput(os.Stderr)
log.Warningf("Can't open logfile: %v", err)
... | [
"func",
"NewServer",
"(",
"filename",
"string",
",",
"environment",
"string",
")",
"(",
"server",
"*",
"Server",
",",
"err",
"error",
")",
"{",
"conf",
",",
"err",
":=",
"GetConfig",
"(",
"filename",
",",
"environment",
")",
"\n",
"logFile",
",",
"err",
... | //NewServer create a new instance of Server | [
"NewServer",
"create",
"a",
"new",
"instance",
"of",
"Server"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/web/server.go#L50-L71 | test |
DamienFontaine/lunarc | web/server.go | Start | func (s *Server) Start() (err error) {
log.Infof("Lunarc is starting on port :%d", s.Config.Port)
var l net.Listener
go func() {
l, err = net.Listen("tcp", fmt.Sprintf(":%d", s.Config.Port))
if err != nil {
log.Errorf("Error: %v", err)
s.Error <- err
return
}
s.isStarted = true
if len(s.Config.SSL... | go | func (s *Server) Start() (err error) {
log.Infof("Lunarc is starting on port :%d", s.Config.Port)
var l net.Listener
go func() {
l, err = net.Listen("tcp", fmt.Sprintf(":%d", s.Config.Port))
if err != nil {
log.Errorf("Error: %v", err)
s.Error <- err
return
}
s.isStarted = true
if len(s.Config.SSL... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Start",
"(",
")",
"(",
"err",
"error",
")",
"{",
"log",
".",
"Infof",
"(",
"\"Lunarc is starting on port :%d\"",
",",
"s",
".",
"Config",
".",
"Port",
")",
"\n",
"var",
"l",
"net",
".",
"Listener",
"\n",
"go",
... | //Start the server. | [
"Start",
"the",
"server",
"."
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/web/server.go#L74-L119 | test |
DamienFontaine/lunarc | web/server.go | Stop | func (s *Server) Stop() {
if s.isStarted && s.quit != nil {
log.Info("Lunarc is stopping...")
s.quit <- true
} else {
log.Info("Lunarc is not running")
s.Error <- errors.New("Lunarc is not running")
s.Done <- false
}
} | go | func (s *Server) Stop() {
if s.isStarted && s.quit != nil {
log.Info("Lunarc is stopping...")
s.quit <- true
} else {
log.Info("Lunarc is not running")
s.Error <- errors.New("Lunarc is not running")
s.Done <- false
}
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"Stop",
"(",
")",
"{",
"if",
"s",
".",
"isStarted",
"&&",
"s",
".",
"quit",
"!=",
"nil",
"{",
"log",
".",
"Info",
"(",
"\"Lunarc is stopping...\"",
")",
"\n",
"s",
".",
"quit",
"<-",
"true",
"\n",
"}",
"else"... | //Stop the server. | [
"Stop",
"the",
"server",
"."
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/web/server.go#L122-L131 | test |
DamienFontaine/lunarc | web/server.go | NewLoggingServeMux | func NewLoggingServeMux(conf Config) *LoggingServeMux {
serveMux := http.NewServeMux()
return &LoggingServeMux{serveMux, conf}
} | go | func NewLoggingServeMux(conf Config) *LoggingServeMux {
serveMux := http.NewServeMux()
return &LoggingServeMux{serveMux, conf}
} | [
"func",
"NewLoggingServeMux",
"(",
"conf",
"Config",
")",
"*",
"LoggingServeMux",
"{",
"serveMux",
":=",
"http",
".",
"NewServeMux",
"(",
")",
"\n",
"return",
"&",
"LoggingServeMux",
"{",
"serveMux",
",",
"conf",
"}",
"\n",
"}"
] | // NewLoggingServeMux allocates and returns a new LoggingServeMux | [
"NewLoggingServeMux",
"allocates",
"and",
"returns",
"a",
"new",
"LoggingServeMux"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/web/server.go#L142-L145 | test |
DamienFontaine/lunarc | web/server.go | Handler | func (mux *LoggingServeMux) Handler(r *http.Request) (h http.Handler, pattern string) {
return mux.serveMux.Handler(r)
} | go | func (mux *LoggingServeMux) Handler(r *http.Request) (h http.Handler, pattern string) {
return mux.serveMux.Handler(r)
} | [
"func",
"(",
"mux",
"*",
"LoggingServeMux",
")",
"Handler",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"(",
"h",
"http",
".",
"Handler",
",",
"pattern",
"string",
")",
"{",
"return",
"mux",
".",
"serveMux",
".",
"Handler",
"(",
"r",
")",
"\n",
"}"... | // Handler sastisfy interface | [
"Handler",
"sastisfy",
"interface"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/web/server.go#L148-L150 | test |
DamienFontaine/lunarc | web/server.go | Handle | func (mux *LoggingServeMux) Handle(pattern string, handler http.Handler) {
var log = logrus.New()
logFile, err := os.OpenFile(mux.conf.Log.File+aFilename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.Out = os.Stderr
log.Warningf("Can't open logfile: %v", err)
} else {
log.Out = logFile
}
... | go | func (mux *LoggingServeMux) Handle(pattern string, handler http.Handler) {
var log = logrus.New()
logFile, err := os.OpenFile(mux.conf.Log.File+aFilename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.Out = os.Stderr
log.Warningf("Can't open logfile: %v", err)
} else {
log.Out = logFile
}
... | [
"func",
"(",
"mux",
"*",
"LoggingServeMux",
")",
"Handle",
"(",
"pattern",
"string",
",",
"handler",
"http",
".",
"Handler",
")",
"{",
"var",
"log",
"=",
"logrus",
".",
"New",
"(",
")",
"\n",
"logFile",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
... | //Handle register handler | [
"Handle",
"register",
"handler"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/web/server.go#L158-L170 | test |
DamienFontaine/lunarc | web/server.go | HandleFunc | func (mux *LoggingServeMux) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request)) {
mux.serveMux.Handle(pattern, http.HandlerFunc(handler))
} | go | func (mux *LoggingServeMux) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request)) {
mux.serveMux.Handle(pattern, http.HandlerFunc(handler))
} | [
"func",
"(",
"mux",
"*",
"LoggingServeMux",
")",
"HandleFunc",
"(",
"pattern",
"string",
",",
"handler",
"func",
"(",
"http",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
")",
")",
"{",
"mux",
".",
"serveMux",
".",
"Handle",
"(",
"pattern",
... | // HandleFunc registers the handler function for the given pattern. | [
"HandleFunc",
"registers",
"the",
"handler",
"function",
"for",
"the",
"given",
"pattern",
"."
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/web/server.go#L173-L175 | test |
malice-plugins/go-plugin-utils | database/elasticsearch/elasticsearch.go | Init | func (db *Database) Init() error {
// Create URL from host/port
db.getURL()
// Test connection to ElasticSearch
err := db.TestConnection()
if err != nil {
return errors.Wrap(err, "failed to connect to database")
}
client, err := elastic.NewSimpleClient(
elastic.SetURL(db.URL),
elastic.SetBasicAuth(
u... | go | func (db *Database) Init() error {
// Create URL from host/port
db.getURL()
// Test connection to ElasticSearch
err := db.TestConnection()
if err != nil {
return errors.Wrap(err, "failed to connect to database")
}
client, err := elastic.NewSimpleClient(
elastic.SetURL(db.URL),
elastic.SetBasicAuth(
u... | [
"func",
"(",
"db",
"*",
"Database",
")",
"Init",
"(",
")",
"error",
"{",
"db",
".",
"getURL",
"(",
")",
"\n",
"err",
":=",
"db",
".",
"TestConnection",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
... | // Init initalizes ElasticSearch for use with malice | [
"Init",
"initalizes",
"ElasticSearch",
"for",
"use",
"with",
"malice"
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/database/elasticsearch/elasticsearch.go#L82-L126 | test |
malice-plugins/go-plugin-utils | database/elasticsearch/elasticsearch.go | WaitForConnection | func (db *Database) WaitForConnection(ctx context.Context, timeout int) error {
var err error
secondsWaited := 0
connCtx, cancel := context.WithTimeout(ctx, time.Duration(timeout)*time.Second)
defer cancel()
log.Debug("===> trying to connect to elasticsearch")
for {
// Try to connect to Elasticsearch
sele... | go | func (db *Database) WaitForConnection(ctx context.Context, timeout int) error {
var err error
secondsWaited := 0
connCtx, cancel := context.WithTimeout(ctx, time.Duration(timeout)*time.Second)
defer cancel()
log.Debug("===> trying to connect to elasticsearch")
for {
// Try to connect to Elasticsearch
sele... | [
"func",
"(",
"db",
"*",
"Database",
")",
"WaitForConnection",
"(",
"ctx",
"context",
".",
"Context",
",",
"timeout",
"int",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"secondsWaited",
":=",
"0",
"\n",
"connCtx",
",",
"cancel",
":=",
"context",
".",
... | // WaitForConnection waits for connection to Elasticsearch to be ready | [
"WaitForConnection",
"waits",
"for",
"connection",
"to",
"Elasticsearch",
"to",
"be",
"ready"
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/database/elasticsearch/elasticsearch.go#L164-L191 | test |
malice-plugins/go-plugin-utils | database/elasticsearch/elasticsearch.go | StoreFileInfo | func (db *Database) StoreFileInfo(sample map[string]interface{}) (elastic.IndexResponse, error) {
if len(db.Plugins) == 0 {
return elastic.IndexResponse{}, errors.New("Database.Plugins is empty (you must set this field to use this function)")
}
// Test connection to ElasticSearch
err := db.TestConnection()
if ... | go | func (db *Database) StoreFileInfo(sample map[string]interface{}) (elastic.IndexResponse, error) {
if len(db.Plugins) == 0 {
return elastic.IndexResponse{}, errors.New("Database.Plugins is empty (you must set this field to use this function)")
}
// Test connection to ElasticSearch
err := db.TestConnection()
if ... | [
"func",
"(",
"db",
"*",
"Database",
")",
"StoreFileInfo",
"(",
"sample",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"elastic",
".",
"IndexResponse",
",",
"error",
")",
"{",
"if",
"len",
"(",
"db",
".",
"Plugins",
")",
"==",
"0",
"{... | // StoreFileInfo inserts initial sample info into database creating a placeholder for it | [
"StoreFileInfo",
"inserts",
"initial",
"sample",
"info",
"into",
"database",
"creating",
"a",
"placeholder",
"for",
"it"
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/database/elasticsearch/elasticsearch.go#L194-L243 | test |
malice-plugins/go-plugin-utils | database/elasticsearch/elasticsearch.go | StorePluginResults | func (db *Database) StorePluginResults(results database.PluginResults) error {
// Test connection to ElasticSearch
err := db.TestConnection()
if err != nil {
return errors.Wrap(err, "failed to connect to database")
}
client, err := elastic.NewSimpleClient(
elastic.SetURL(db.URL),
elastic.SetBasicAuth(
u... | go | func (db *Database) StorePluginResults(results database.PluginResults) error {
// Test connection to ElasticSearch
err := db.TestConnection()
if err != nil {
return errors.Wrap(err, "failed to connect to database")
}
client, err := elastic.NewSimpleClient(
elastic.SetURL(db.URL),
elastic.SetBasicAuth(
u... | [
"func",
"(",
"db",
"*",
"Database",
")",
"StorePluginResults",
"(",
"results",
"database",
".",
"PluginResults",
")",
"error",
"{",
"err",
":=",
"db",
".",
"TestConnection",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
... | // StorePluginResults stores a plugin's results in the database by updating
// the placeholder created by the call to StoreFileInfo | [
"StorePluginResults",
"stores",
"a",
"plugin",
"s",
"results",
"in",
"the",
"database",
"by",
"updating",
"the",
"placeholder",
"created",
"by",
"the",
"call",
"to",
"StoreFileInfo"
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/database/elasticsearch/elasticsearch.go#L305-L384 | test |
malice-plugins/go-plugin-utils | utils/utils.go | CamelCase | func CamelCase(src string) string {
byteSrc := []byte(src)
chunks := camelingRegex.FindAll(byteSrc, -1)
for idx, val := range chunks {
if idx > 0 {
chunks[idx] = bytes.Title(val)
}
}
return string(bytes.Join(chunks, nil))
} | go | func CamelCase(src string) string {
byteSrc := []byte(src)
chunks := camelingRegex.FindAll(byteSrc, -1)
for idx, val := range chunks {
if idx > 0 {
chunks[idx] = bytes.Title(val)
}
}
return string(bytes.Join(chunks, nil))
} | [
"func",
"CamelCase",
"(",
"src",
"string",
")",
"string",
"{",
"byteSrc",
":=",
"[",
"]",
"byte",
"(",
"src",
")",
"\n",
"chunks",
":=",
"camelingRegex",
".",
"FindAll",
"(",
"byteSrc",
",",
"-",
"1",
")",
"\n",
"for",
"idx",
",",
"val",
":=",
"ran... | // CamelCase converts strings to their camel case equivalent | [
"CamelCase",
"converts",
"strings",
"to",
"their",
"camel",
"case",
"equivalent"
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/utils/utils.go#L45-L54 | test |
malice-plugins/go-plugin-utils | utils/utils.go | Getopt | func Getopt(name, dfault string) string {
value := os.Getenv(name)
if value == "" {
value = dfault
}
return value
} | go | func Getopt(name, dfault string) string {
value := os.Getenv(name)
if value == "" {
value = dfault
}
return value
} | [
"func",
"Getopt",
"(",
"name",
",",
"dfault",
"string",
")",
"string",
"{",
"value",
":=",
"os",
".",
"Getenv",
"(",
"name",
")",
"\n",
"if",
"value",
"==",
"\"\"",
"{",
"value",
"=",
"dfault",
"\n",
"}",
"\n",
"return",
"value",
"\n",
"}"
] | // Getopt reads environment variables.
// If not found will return a supplied default value | [
"Getopt",
"reads",
"environment",
"variables",
".",
"If",
"not",
"found",
"will",
"return",
"a",
"supplied",
"default",
"value"
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/utils/utils.go#L58-L64 | test |
malice-plugins/go-plugin-utils | utils/utils.go | Getopts | func Getopts(userInput, envVar, dfault string) string {
if len(strings.TrimSpace(userInput)) > 0 {
return userInput
}
value := os.Getenv(envVar)
if value == "" {
value = dfault
}
return value
} | go | func Getopts(userInput, envVar, dfault string) string {
if len(strings.TrimSpace(userInput)) > 0 {
return userInput
}
value := os.Getenv(envVar)
if value == "" {
value = dfault
}
return value
} | [
"func",
"Getopts",
"(",
"userInput",
",",
"envVar",
",",
"dfault",
"string",
")",
"string",
"{",
"if",
"len",
"(",
"strings",
".",
"TrimSpace",
"(",
"userInput",
")",
")",
">",
"0",
"{",
"return",
"userInput",
"\n",
"}",
"\n",
"value",
":=",
"os",
".... | // Getopts reads from user input then environment variable and finally a sane default. | [
"Getopts",
"reads",
"from",
"user",
"input",
"then",
"environment",
"variable",
"and",
"finally",
"a",
"sane",
"default",
"."
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/utils/utils.go#L67-L77 | test |
malice-plugins/go-plugin-utils | utils/utils.go | GetSHA256 | func GetSHA256(name string) string {
dat, err := ioutil.ReadFile(name)
Assert(err)
h256 := sha256.New()
_, err = h256.Write(dat)
Assert(err)
return fmt.Sprintf("%x", h256.Sum(nil))
} | go | func GetSHA256(name string) string {
dat, err := ioutil.ReadFile(name)
Assert(err)
h256 := sha256.New()
_, err = h256.Write(dat)
Assert(err)
return fmt.Sprintf("%x", h256.Sum(nil))
} | [
"func",
"GetSHA256",
"(",
"name",
"string",
")",
"string",
"{",
"dat",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"name",
")",
"\n",
"Assert",
"(",
"err",
")",
"\n",
"h256",
":=",
"sha256",
".",
"New",
"(",
")",
"\n",
"_",
",",
"err",
"=",... | // GetSHA256 calculates a file's sha256sum | [
"GetSHA256",
"calculates",
"a",
"file",
"s",
"sha256sum"
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/utils/utils.go#L87-L97 | test |
malice-plugins/go-plugin-utils | utils/utils.go | RunCommand | func RunCommand(ctx context.Context, cmd string, args ...string) (string, error) {
var c *exec.Cmd
if ctx != nil {
c = exec.CommandContext(ctx, cmd, args...)
} else {
c = exec.Command(cmd, args...)
}
output, err := c.Output()
if err != nil {
return string(output), err
}
// check for exec context timeo... | go | func RunCommand(ctx context.Context, cmd string, args ...string) (string, error) {
var c *exec.Cmd
if ctx != nil {
c = exec.CommandContext(ctx, cmd, args...)
} else {
c = exec.Command(cmd, args...)
}
output, err := c.Output()
if err != nil {
return string(output), err
}
// check for exec context timeo... | [
"func",
"RunCommand",
"(",
"ctx",
"context",
".",
"Context",
",",
"cmd",
"string",
",",
"args",
"...",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"c",
"*",
"exec",
".",
"Cmd",
"\n",
"if",
"ctx",
"!=",
"nil",
"{",
"c",
"=",
"exec... | // RunCommand runs cmd on file | [
"RunCommand",
"runs",
"cmd",
"on",
"file"
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/utils/utils.go#L100-L123 | test |
malice-plugins/go-plugin-utils | utils/utils.go | RemoveDuplicates | func RemoveDuplicates(elements []string) []string {
// Use map to record duplicates as we find them.
encountered := map[string]bool{}
result := []string{}
for v := range elements {
if encountered[elements[v]] == true {
// Do not add duplicate.
} else {
// Record this element as an encountered element.
... | go | func RemoveDuplicates(elements []string) []string {
// Use map to record duplicates as we find them.
encountered := map[string]bool{}
result := []string{}
for v := range elements {
if encountered[elements[v]] == true {
// Do not add duplicate.
} else {
// Record this element as an encountered element.
... | [
"func",
"RemoveDuplicates",
"(",
"elements",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"encountered",
":=",
"map",
"[",
"string",
"]",
"bool",
"{",
"}",
"\n",
"result",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"v",
":=",
"range",
"e... | // RemoveDuplicates removes duplicate items from a list | [
"RemoveDuplicates",
"removes",
"duplicate",
"items",
"from",
"a",
"list"
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/utils/utils.go#L130-L147 | test |
malice-plugins/go-plugin-utils | utils/utils.go | Unzip | func Unzip(archive, target string) error {
// fmt.Println("Unzip archive ", target)
reader, err := zip.OpenReader(archive)
if err != nil {
return err
}
defer reader.Close()
for _, file := range reader.File {
filePath := filepath.Join(target, file.Name)
if file.FileInfo().IsDir() {
os.MkdirAll(filePat... | go | func Unzip(archive, target string) error {
// fmt.Println("Unzip archive ", target)
reader, err := zip.OpenReader(archive)
if err != nil {
return err
}
defer reader.Close()
for _, file := range reader.File {
filePath := filepath.Join(target, file.Name)
if file.FileInfo().IsDir() {
os.MkdirAll(filePat... | [
"func",
"Unzip",
"(",
"archive",
",",
"target",
"string",
")",
"error",
"{",
"reader",
",",
"err",
":=",
"zip",
".",
"OpenReader",
"(",
"archive",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"reader",
".",
"... | // Unzip unzips archive to target location | [
"Unzip",
"unzips",
"archive",
"to",
"target",
"location"
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/utils/utils.go#L190-L224 | test |
malice-plugins/go-plugin-utils | utils/utils.go | SliceContainsString | func SliceContainsString(a string, list []string) bool {
for _, b := range list {
if strings.Contains(b, a) {
return true
}
}
return false
} | go | func SliceContainsString(a string, list []string) bool {
for _, b := range list {
if strings.Contains(b, a) {
return true
}
}
return false
} | [
"func",
"SliceContainsString",
"(",
"a",
"string",
",",
"list",
"[",
"]",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"b",
":=",
"range",
"list",
"{",
"if",
"strings",
".",
"Contains",
"(",
"b",
",",
"a",
")",
"{",
"return",
"true",
"\n",
"}",
"... | // SliceContainsString returns if slice contains substring | [
"SliceContainsString",
"returns",
"if",
"slice",
"contains",
"substring"
] | 9ee76663c3b0a531b8c529f03f12a5a84ff9b61b | https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/utils/utils.go#L227-L234 | test |
DamienFontaine/lunarc | smtp/server.go | NewSMTP | func NewSMTP(filename string, environment string) (s *SMTP, err error) {
conf, err := GetSMTP(filename, environment)
if err != nil {
return
}
auth := smtp.PlainAuth("", conf.Auth.User, conf.Auth.Password, conf.Host)
f := smtp.SendMail
if conf.SSL {
f = SendMailSSL
}
s = &SMTP{auth: auth, send: f, addr: fmt.... | go | func NewSMTP(filename string, environment string) (s *SMTP, err error) {
conf, err := GetSMTP(filename, environment)
if err != nil {
return
}
auth := smtp.PlainAuth("", conf.Auth.User, conf.Auth.Password, conf.Host)
f := smtp.SendMail
if conf.SSL {
f = SendMailSSL
}
s = &SMTP{auth: auth, send: f, addr: fmt.... | [
"func",
"NewSMTP",
"(",
"filename",
"string",
",",
"environment",
"string",
")",
"(",
"s",
"*",
"SMTP",
",",
"err",
"error",
")",
"{",
"conf",
",",
"err",
":=",
"GetSMTP",
"(",
"filename",
",",
"environment",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",... | //NewSMTP create new SMTP | [
"NewSMTP",
"create",
"new",
"SMTP"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/smtp/server.go#L36-L48 | test |
DamienFontaine/lunarc | smtp/server.go | SendMail | func (s *SMTP) SendMail(from string, to []string, msg []byte) (err error) {
err = s.send(s.addr, s.auth, from, to, msg)
return
} | go | func (s *SMTP) SendMail(from string, to []string, msg []byte) (err error) {
err = s.send(s.addr, s.auth, from, to, msg)
return
} | [
"func",
"(",
"s",
"*",
"SMTP",
")",
"SendMail",
"(",
"from",
"string",
",",
"to",
"[",
"]",
"string",
",",
"msg",
"[",
"]",
"byte",
")",
"(",
"err",
"error",
")",
"{",
"err",
"=",
"s",
".",
"send",
"(",
"s",
".",
"addr",
",",
"s",
".",
"aut... | //SendMail send an email | [
"SendMail",
"send",
"an",
"email"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/smtp/server.go#L51-L54 | test |
DamienFontaine/lunarc | smtp/config.go | GetEnvironment | func (se *SMTPEnvironment) GetEnvironment(environment string) interface{} {
for env, conf := range se.Env {
if strings.Compare(environment, env) == 0 {
return conf
}
}
return nil
} | go | func (se *SMTPEnvironment) GetEnvironment(environment string) interface{} {
for env, conf := range se.Env {
if strings.Compare(environment, env) == 0 {
return conf
}
}
return nil
} | [
"func",
"(",
"se",
"*",
"SMTPEnvironment",
")",
"GetEnvironment",
"(",
"environment",
"string",
")",
"interface",
"{",
"}",
"{",
"for",
"env",
",",
"conf",
":=",
"range",
"se",
".",
"Env",
"{",
"if",
"strings",
".",
"Compare",
"(",
"environment",
",",
... | //GetEnvironment returns a SMTP Server configuration for the specified environment in parameter | [
"GetEnvironment",
"returns",
"a",
"SMTP",
"Server",
"configuration",
"for",
"the",
"specified",
"environment",
"in",
"parameter"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/smtp/config.go#L58-L65 | test |
DamienFontaine/lunarc | smtp/config.go | GetSMTP | func GetSMTP(source interface{}, environment string) (smtp Config, err error) {
var smtpEnvironment SMTPEnvironment
i, err := config.Get(source, environment, &smtpEnvironment)
smtp = i.(Config)
return
} | go | func GetSMTP(source interface{}, environment string) (smtp Config, err error) {
var smtpEnvironment SMTPEnvironment
i, err := config.Get(source, environment, &smtpEnvironment)
smtp = i.(Config)
return
} | [
"func",
"GetSMTP",
"(",
"source",
"interface",
"{",
"}",
",",
"environment",
"string",
")",
"(",
"smtp",
"Config",
",",
"err",
"error",
")",
"{",
"var",
"smtpEnvironment",
"SMTPEnvironment",
"\n",
"i",
",",
"err",
":=",
"config",
".",
"Get",
"(",
"source... | //GetSMTP returns a SMTP Server configurations | [
"GetSMTP",
"returns",
"a",
"SMTP",
"Server",
"configurations"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/smtp/config.go#L68-L73 | test |
DamienFontaine/lunarc | web/config.go | GetConfig | func GetConfig(source interface{}, environment string) (server Config, err error) {
var serverEnvironment ServerEnvironment
i, err := config.Get(source, environment, &serverEnvironment)
server = i.(Config)
return
} | go | func GetConfig(source interface{}, environment string) (server Config, err error) {
var serverEnvironment ServerEnvironment
i, err := config.Get(source, environment, &serverEnvironment)
server = i.(Config)
return
} | [
"func",
"GetConfig",
"(",
"source",
"interface",
"{",
"}",
",",
"environment",
"string",
")",
"(",
"server",
"Config",
",",
"err",
"error",
")",
"{",
"var",
"serverEnvironment",
"ServerEnvironment",
"\n",
"i",
",",
"err",
":=",
"config",
".",
"Get",
"(",
... | //GetConfig returns a Server configurations | [
"GetConfig",
"returns",
"a",
"Server",
"configurations"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/web/config.go#L75-L80 | test |
DamienFontaine/lunarc | datasource/mongo/config.go | GetEnvironment | func (m *Environment) GetEnvironment(environment string) interface{} {
for env, conf := range m.Env {
if strings.Compare(environment, env) == 0 {
return conf
}
}
return nil
} | go | func (m *Environment) GetEnvironment(environment string) interface{} {
for env, conf := range m.Env {
if strings.Compare(environment, env) == 0 {
return conf
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"Environment",
")",
"GetEnvironment",
"(",
"environment",
"string",
")",
"interface",
"{",
"}",
"{",
"for",
"env",
",",
"conf",
":=",
"range",
"m",
".",
"Env",
"{",
"if",
"strings",
".",
"Compare",
"(",
"environment",
",",
"env",... | //GetEnvironment returns a Mongo configuration for the specified environment in parameter | [
"GetEnvironment",
"returns",
"a",
"Mongo",
"configuration",
"for",
"the",
"specified",
"environment",
"in",
"parameter"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/datasource/mongo/config.go#L56-L63 | test |
DamienFontaine/lunarc | datasource/mongo/config.go | GetMongo | func GetMongo(source interface{}, environment string) (mongo Config, err error) {
var env Environment
i, err := config.Get(source, environment, &env)
mongo = i.(Config)
return
} | go | func GetMongo(source interface{}, environment string) (mongo Config, err error) {
var env Environment
i, err := config.Get(source, environment, &env)
mongo = i.(Config)
return
} | [
"func",
"GetMongo",
"(",
"source",
"interface",
"{",
"}",
",",
"environment",
"string",
")",
"(",
"mongo",
"Config",
",",
"err",
"error",
")",
"{",
"var",
"env",
"Environment",
"\n",
"i",
",",
"err",
":=",
"config",
".",
"Get",
"(",
"source",
",",
"e... | //GetMongo returns a Mongo configurations | [
"GetMongo",
"returns",
"a",
"Mongo",
"configurations"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/datasource/mongo/config.go#L66-L71 | test |
DamienFontaine/lunarc | security/handler.go | TokenHandler | func TokenHandler(next http.Handler, cnf web.Config) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
token, err := request.ParseFromRequest(r, request.AuthorizationHeaderExtractor, func(token *jwt.Token) (interface{}, error) {
if _, ok := token.Method.(*jwt.SigningMethodHMAC)... | go | func TokenHandler(next http.Handler, cnf web.Config) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
token, err := request.ParseFromRequest(r, request.AuthorizationHeaderExtractor, func(token *jwt.Token) (interface{}, error) {
if _, ok := token.Method.(*jwt.SigningMethodHMAC)... | [
"func",
"TokenHandler",
"(",
"next",
"http",
".",
"Handler",
",",
"cnf",
"web",
".",
"Config",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"... | //TokenHandler manage authorizations | [
"TokenHandler",
"manage",
"authorizations"
] | 2e7332a51f554794a549a313430eaa7dec8d13cc | https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/security/handler.go#L28-L47 | test |
soygul/gcm | ccs/ccs.go | Receive | func (c *Conn) Receive() (*InMsg, error) {
stanza, err := c.xmppConn.Recv()
if err != nil {
return nil, err
}
if c.debug {
log.Printf("Incoming raw CCS stanza: %+v\n", stanza)
}
chat, ok := stanza.(xmpp.Chat)
if !ok {
return nil, nil
}
if chat.Type == "error" {
// todo: once go-xmpp can parse XMPP e... | go | func (c *Conn) Receive() (*InMsg, error) {
stanza, err := c.xmppConn.Recv()
if err != nil {
return nil, err
}
if c.debug {
log.Printf("Incoming raw CCS stanza: %+v\n", stanza)
}
chat, ok := stanza.(xmpp.Chat)
if !ok {
return nil, nil
}
if chat.Type == "error" {
// todo: once go-xmpp can parse XMPP e... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"Receive",
"(",
")",
"(",
"*",
"InMsg",
",",
"error",
")",
"{",
"stanza",
",",
"err",
":=",
"c",
".",
"xmppConn",
".",
"Recv",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n... | // Receive waits to receive the next incoming messages from the CCS connection. | [
"Receive",
"waits",
"to",
"receive",
"the",
"next",
"incoming",
"messages",
"from",
"the",
"CCS",
"connection",
"."
] | 08c1e33b494fc198134b9f1000c99b2ff8d1883b | https://github.com/soygul/gcm/blob/08c1e33b494fc198134b9f1000c99b2ff8d1883b/ccs/ccs.go#L53-L98 | test |
soygul/gcm | ccs/ccs.go | Send | func (c *Conn) Send(m *OutMsg) (n int, err error) {
if m.ID == "" {
if m.ID, err = getMsgID(); err != nil {
return 0, err
}
}
mb, err := json.Marshal(m)
if err != nil {
return 0, err
}
ms := string(mb)
res := fmt.Sprintf(gcmMessageStanza, ms)
return c.xmppConn.SendOrg(res)
} | go | func (c *Conn) Send(m *OutMsg) (n int, err error) {
if m.ID == "" {
if m.ID, err = getMsgID(); err != nil {
return 0, err
}
}
mb, err := json.Marshal(m)
if err != nil {
return 0, err
}
ms := string(mb)
res := fmt.Sprintf(gcmMessageStanza, ms)
return c.xmppConn.SendOrg(res)
} | [
"func",
"(",
"c",
"*",
"Conn",
")",
"Send",
"(",
"m",
"*",
"OutMsg",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"if",
"m",
".",
"ID",
"==",
"\"\"",
"{",
"if",
"m",
".",
"ID",
",",
"err",
"=",
"getMsgID",
"(",
")",
";",
"err",
"!... | // Send sends a message to GCM CCS server and returns the number of bytes written and any error encountered.
// If empty message ID is given, it's auto-generated and message object is modified with the generated ID. | [
"Send",
"sends",
"a",
"message",
"to",
"GCM",
"CCS",
"server",
"and",
"returns",
"the",
"number",
"of",
"bytes",
"written",
"and",
"any",
"error",
"encountered",
".",
"If",
"empty",
"message",
"ID",
"is",
"given",
"it",
"s",
"auto",
"-",
"generated",
"an... | 08c1e33b494fc198134b9f1000c99b2ff8d1883b | https://github.com/soygul/gcm/blob/08c1e33b494fc198134b9f1000c99b2ff8d1883b/ccs/ccs.go#L102-L116 | test |
enaml-ops/enaml | diff/pivnetreleasediffer.go | allBoshReleaseNames | func (d pivnetReleaseDiffer) allBoshReleaseNames() []string {
boshReleaseNamesMap := make(map[string]string)
var addReleaseNames = func(br map[string]*release.BoshRelease) {
for brname := range br {
boshReleaseNamesMap[brname] = brname
}
}
addReleaseNames(d.release1.BoshRelease)
addReleaseNames(d.release2.B... | go | func (d pivnetReleaseDiffer) allBoshReleaseNames() []string {
boshReleaseNamesMap := make(map[string]string)
var addReleaseNames = func(br map[string]*release.BoshRelease) {
for brname := range br {
boshReleaseNamesMap[brname] = brname
}
}
addReleaseNames(d.release1.BoshRelease)
addReleaseNames(d.release2.B... | [
"func",
"(",
"d",
"pivnetReleaseDiffer",
")",
"allBoshReleaseNames",
"(",
")",
"[",
"]",
"string",
"{",
"boshReleaseNamesMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"var",
"addReleaseNames",
"=",
"func",
"(",
"br",
"map",
"[",
... | // allBoshReleaseNames returns a union of unique BOSH release names across all
// contained BOSH releases. | [
"allBoshReleaseNames",
"returns",
"a",
"union",
"of",
"unique",
"BOSH",
"release",
"names",
"across",
"all",
"contained",
"BOSH",
"releases",
"."
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/diff/pivnetreleasediffer.go#L59-L73 | test |
enaml-ops/enaml | diff/result.go | AddedProperty | func (dj *DeltaJob) AddedProperty(name string, p *enaml.JobManifestProperty) {
dj.AddedProperties[name] = *p
} | go | func (dj *DeltaJob) AddedProperty(name string, p *enaml.JobManifestProperty) {
dj.AddedProperties[name] = *p
} | [
"func",
"(",
"dj",
"*",
"DeltaJob",
")",
"AddedProperty",
"(",
"name",
"string",
",",
"p",
"*",
"enaml",
".",
"JobManifestProperty",
")",
"{",
"dj",
".",
"AddedProperties",
"[",
"name",
"]",
"=",
"*",
"p",
"\n",
"}"
] | // AddedProperty adds a new "added" job property to the list of differences | [
"AddedProperty",
"adds",
"a",
"new",
"added",
"job",
"property",
"to",
"the",
"list",
"of",
"differences"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/diff/result.go#L29-L31 | test |
enaml-ops/enaml | diff/result.go | RemovedProperty | func (dj *DeltaJob) RemovedProperty(name string, p *enaml.JobManifestProperty) {
dj.RemovedProperties[name] = *p
} | go | func (dj *DeltaJob) RemovedProperty(name string, p *enaml.JobManifestProperty) {
dj.RemovedProperties[name] = *p
} | [
"func",
"(",
"dj",
"*",
"DeltaJob",
")",
"RemovedProperty",
"(",
"name",
"string",
",",
"p",
"*",
"enaml",
".",
"JobManifestProperty",
")",
"{",
"dj",
".",
"RemovedProperties",
"[",
"name",
"]",
"=",
"*",
"p",
"\n",
"}"
] | // RemovedProperty adds a new "removed" job property to the list of differences | [
"RemovedProperty",
"adds",
"a",
"new",
"removed",
"job",
"property",
"to",
"the",
"list",
"of",
"differences"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/diff/result.go#L34-L36 | test |
enaml-ops/enaml | diff/result.go | AddDeltaJob | func (r *Result) AddDeltaJob(dj *DeltaJob) {
r.DeltaJob = append(r.DeltaJob, *dj)
} | go | func (r *Result) AddDeltaJob(dj *DeltaJob) {
r.DeltaJob = append(r.DeltaJob, *dj)
} | [
"func",
"(",
"r",
"*",
"Result",
")",
"AddDeltaJob",
"(",
"dj",
"*",
"DeltaJob",
")",
"{",
"r",
".",
"DeltaJob",
"=",
"append",
"(",
"r",
".",
"DeltaJob",
",",
"*",
"dj",
")",
"\n",
"}"
] | // AddDeltaJob adds a new delta for a specific job | [
"AddDeltaJob",
"adds",
"a",
"new",
"delta",
"for",
"a",
"specific",
"job"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/diff/result.go#L39-L41 | test |
enaml-ops/enaml | diff/result.go | Concat | func (r *Result) Concat(other *Result) {
for _, dj := range other.DeltaJob {
r.DeltaJob = append(r.DeltaJob, dj)
}
} | go | func (r *Result) Concat(other *Result) {
for _, dj := range other.DeltaJob {
r.DeltaJob = append(r.DeltaJob, dj)
}
} | [
"func",
"(",
"r",
"*",
"Result",
")",
"Concat",
"(",
"other",
"*",
"Result",
")",
"{",
"for",
"_",
",",
"dj",
":=",
"range",
"other",
".",
"DeltaJob",
"{",
"r",
".",
"DeltaJob",
"=",
"append",
"(",
"r",
".",
"DeltaJob",
",",
"dj",
")",
"\n",
"}... | // Concat adds the other result to this result | [
"Concat",
"adds",
"the",
"other",
"result",
"to",
"this",
"result"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/diff/result.go#L44-L48 | test |
enaml-ops/enaml | pull/releasepull.go | Read | func (r *Release) Read(releaseLocation string) (io.ReadCloser, error) {
local, err := r.Pull(releaseLocation)
if err != nil {
return nil, err
}
rr, err := os.Open(local)
if err != nil {
return nil, err
}
return rr, nil
} | go | func (r *Release) Read(releaseLocation string) (io.ReadCloser, error) {
local, err := r.Pull(releaseLocation)
if err != nil {
return nil, err
}
rr, err := os.Open(local)
if err != nil {
return nil, err
}
return rr, nil
} | [
"func",
"(",
"r",
"*",
"Release",
")",
"Read",
"(",
"releaseLocation",
"string",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"local",
",",
"err",
":=",
"r",
".",
"Pull",
"(",
"releaseLocation",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{... | // Read downloads the specified Release to the local cache dir and returns a
// reader to the underyling release package. | [
"Read",
"downloads",
"the",
"specified",
"Release",
"to",
"the",
"local",
"cache",
"dir",
"and",
"returns",
"a",
"reader",
"to",
"the",
"underyling",
"release",
"package",
"."
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/pull/releasepull.go#L26-L36 | test |
enaml-ops/enaml | pull/releasepull.go | Pull | func (r *Release) Pull(releaseLocation string) (filename string, err error) {
u, uerr := url.Parse(releaseLocation)
if uerr != nil || !(u.Scheme == "http" || u.Scheme == "https") {
// assume a local file, ensure it exists
if _, ferr := os.Stat(releaseLocation); os.IsNotExist(ferr) {
err = fmt.Errorf("Could not... | go | func (r *Release) Pull(releaseLocation string) (filename string, err error) {
u, uerr := url.Parse(releaseLocation)
if uerr != nil || !(u.Scheme == "http" || u.Scheme == "https") {
// assume a local file, ensure it exists
if _, ferr := os.Stat(releaseLocation); os.IsNotExist(ferr) {
err = fmt.Errorf("Could not... | [
"func",
"(",
"r",
"*",
"Release",
")",
"Pull",
"(",
"releaseLocation",
"string",
")",
"(",
"filename",
"string",
",",
"err",
"error",
")",
"{",
"u",
",",
"uerr",
":=",
"url",
".",
"Parse",
"(",
"releaseLocation",
")",
"\n",
"if",
"uerr",
"!=",
"nil",... | // Pull downloads the specified Release to the local cache dir | [
"Pull",
"downloads",
"the",
"specified",
"Release",
"to",
"the",
"local",
"cache",
"dir"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/pull/releasepull.go#L39-L57 | test |
enaml-ops/enaml | releasejob_experiment/job.go | BuildJob | func BuildJob(jobMeta BoshJobMeta, dest string) error {
b, err := json.Marshal(jobMeta)
if err != nil {
return err
}
fmt.Println("building job: ", string(b))
monitFile, specFile, err := createJobFiles(dest, jobMeta.Name)
if err != nil {
return err
}
defer monitFile.Close()
defer specFile.Close()
err = w... | go | func BuildJob(jobMeta BoshJobMeta, dest string) error {
b, err := json.Marshal(jobMeta)
if err != nil {
return err
}
fmt.Println("building job: ", string(b))
monitFile, specFile, err := createJobFiles(dest, jobMeta.Name)
if err != nil {
return err
}
defer monitFile.Close()
defer specFile.Close()
err = w... | [
"func",
"BuildJob",
"(",
"jobMeta",
"BoshJobMeta",
",",
"dest",
"string",
")",
"error",
"{",
"b",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"jobMeta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"fmt",
".",
"Pri... | //BuildJob - function to create a compiled version of the current job | [
"BuildJob",
"-",
"function",
"to",
"create",
"a",
"compiled",
"version",
"of",
"the",
"current",
"job"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/releasejob_experiment/job.go#L42-L63 | test |
enaml-ops/enaml | release/boshrelease.go | LoadBoshRelease | func LoadBoshRelease(releaseRepo pull.Release, path string) (release *BoshRelease, err error) {
var rr io.ReadCloser
rr, err = releaseRepo.Read(path)
if err != nil {
return
}
defer func() {
if cerr := rr.Close(); cerr != nil {
err = cerr
}
}()
release, err = readBoshRelease(rr)
return
} | go | func LoadBoshRelease(releaseRepo pull.Release, path string) (release *BoshRelease, err error) {
var rr io.ReadCloser
rr, err = releaseRepo.Read(path)
if err != nil {
return
}
defer func() {
if cerr := rr.Close(); cerr != nil {
err = cerr
}
}()
release, err = readBoshRelease(rr)
return
} | [
"func",
"LoadBoshRelease",
"(",
"releaseRepo",
"pull",
".",
"Release",
",",
"path",
"string",
")",
"(",
"release",
"*",
"BoshRelease",
",",
"err",
"error",
")",
"{",
"var",
"rr",
"io",
".",
"ReadCloser",
"\n",
"rr",
",",
"err",
"=",
"releaseRepo",
".",
... | // LoadBoshRelease creates an initialized boshRelease instance from the
// specifed local or remote .tgz file | [
"LoadBoshRelease",
"creates",
"an",
"initialized",
"boshRelease",
"instance",
"from",
"the",
"specifed",
"local",
"or",
"remote",
".",
"tgz",
"file"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/release/boshrelease.go#L26-L39 | test |
enaml-ops/enaml | release/boshrelease.go | readBoshRelease | func readBoshRelease(rr io.Reader) (*BoshRelease, error) {
release := &BoshRelease{
JobManifests: make(map[string]enaml.JobManifest),
}
err := release.readBoshRelease(rr)
return release, err
} | go | func readBoshRelease(rr io.Reader) (*BoshRelease, error) {
release := &BoshRelease{
JobManifests: make(map[string]enaml.JobManifest),
}
err := release.readBoshRelease(rr)
return release, err
} | [
"func",
"readBoshRelease",
"(",
"rr",
"io",
".",
"Reader",
")",
"(",
"*",
"BoshRelease",
",",
"error",
")",
"{",
"release",
":=",
"&",
"BoshRelease",
"{",
"JobManifests",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"enaml",
".",
"JobManifest",
")",
",... | // readBoshRelease creates an initialized boshRelease instance from the
// specifed .tgz reader | [
"readBoshRelease",
"creates",
"an",
"initialized",
"boshRelease",
"instance",
"from",
"the",
"specifed",
".",
"tgz",
"reader"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/release/boshrelease.go#L43-L49 | test |
enaml-ops/enaml | release/boshrelease.go | readBoshRelease | func (r *BoshRelease) readBoshRelease(rr io.Reader) error {
w := pkg.NewTgzWalker(rr)
w.OnMatch("release.MF", func(file pkg.FileEntry) error {
return decodeYaml(file.Reader, &r.ReleaseManifest)
})
w.OnMatch("/jobs/", func(file pkg.FileEntry) error {
job, jerr := r.readBoshJob(file.Reader)
if jerr == nil {
... | go | func (r *BoshRelease) readBoshRelease(rr io.Reader) error {
w := pkg.NewTgzWalker(rr)
w.OnMatch("release.MF", func(file pkg.FileEntry) error {
return decodeYaml(file.Reader, &r.ReleaseManifest)
})
w.OnMatch("/jobs/", func(file pkg.FileEntry) error {
job, jerr := r.readBoshJob(file.Reader)
if jerr == nil {
... | [
"func",
"(",
"r",
"*",
"BoshRelease",
")",
"readBoshRelease",
"(",
"rr",
"io",
".",
"Reader",
")",
"error",
"{",
"w",
":=",
"pkg",
".",
"NewTgzWalker",
"(",
"rr",
")",
"\n",
"w",
".",
"OnMatch",
"(",
"\"release.MF\"",
",",
"func",
"(",
"file",
"pkg",... | // readBoshRelease reads a bosh release out of the given reader into a new
// boshRelease struct | [
"readBoshRelease",
"reads",
"a",
"bosh",
"release",
"out",
"of",
"the",
"given",
"reader",
"into",
"a",
"new",
"boshRelease",
"struct"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/release/boshrelease.go#L53-L67 | test |
enaml-ops/enaml | release/boshrelease.go | readBoshJob | func (r *BoshRelease) readBoshJob(jr io.Reader) (enaml.JobManifest, error) {
var job enaml.JobManifest
jw := pkg.NewTgzWalker(jr)
jw.OnMatch("job.MF", func(file pkg.FileEntry) error {
return decodeYaml(file.Reader, &job)
})
err := jw.Walk()
return job, err
} | go | func (r *BoshRelease) readBoshJob(jr io.Reader) (enaml.JobManifest, error) {
var job enaml.JobManifest
jw := pkg.NewTgzWalker(jr)
jw.OnMatch("job.MF", func(file pkg.FileEntry) error {
return decodeYaml(file.Reader, &job)
})
err := jw.Walk()
return job, err
} | [
"func",
"(",
"r",
"*",
"BoshRelease",
")",
"readBoshJob",
"(",
"jr",
"io",
".",
"Reader",
")",
"(",
"enaml",
".",
"JobManifest",
",",
"error",
")",
"{",
"var",
"job",
"enaml",
".",
"JobManifest",
"\n",
"jw",
":=",
"pkg",
".",
"NewTgzWalker",
"(",
"jr... | // readBoshJob reads a BOSH job manifest out of the given reader into a new
// JobManifest struct | [
"readBoshJob",
"reads",
"a",
"BOSH",
"job",
"manifest",
"out",
"of",
"the",
"given",
"reader",
"into",
"a",
"new",
"JobManifest",
"struct"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/release/boshrelease.go#L71-L79 | test |
enaml-ops/enaml | enamlbosh/api.go | NewRequest | func (s *Client) NewRequest(method, url string, body io.Reader) (*http.Request, error) {
req, err := http.NewRequest(method, url, body)
if err != nil {
return nil, err
}
setAuth(s, req)
return req, nil
} | go | func (s *Client) NewRequest(method, url string, body io.Reader) (*http.Request, error) {
req, err := http.NewRequest(method, url, body)
if err != nil {
return nil, err
}
setAuth(s, req)
return req, nil
} | [
"func",
"(",
"s",
"*",
"Client",
")",
"NewRequest",
"(",
"method",
",",
"url",
"string",
",",
"body",
"io",
".",
"Reader",
")",
"(",
"*",
"http",
".",
"Request",
",",
"error",
")",
"{",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"me... | // NewRequest is like http.NewRequest, with the exception that it will add
// basic auth headers if the client is configured for basic auth. | [
"NewRequest",
"is",
"like",
"http",
".",
"NewRequest",
"with",
"the",
"exception",
"that",
"it",
"will",
"add",
"basic",
"auth",
"headers",
"if",
"the",
"client",
"is",
"configured",
"for",
"basic",
"auth",
"."
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/enamlbosh/api.go#L111-L119 | test |
enaml-ops/enaml | enamlbosh/api.go | PushCloudConfig | func (s *Client) PushCloudConfig(manifest []byte) error {
ccm := enaml.NewCloudConfigManifest(manifest)
req, err := s.newCloudConfigRequest(*ccm)
if err != nil {
return err
}
res, err := s.http.Do(req)
if err != nil {
return err
}
defer res.Body.Close()
if res.StatusCode >= 400 {
body, err := ioutil.Read... | go | func (s *Client) PushCloudConfig(manifest []byte) error {
ccm := enaml.NewCloudConfigManifest(manifest)
req, err := s.newCloudConfigRequest(*ccm)
if err != nil {
return err
}
res, err := s.http.Do(req)
if err != nil {
return err
}
defer res.Body.Close()
if res.StatusCode >= 400 {
body, err := ioutil.Read... | [
"func",
"(",
"s",
"*",
"Client",
")",
"PushCloudConfig",
"(",
"manifest",
"[",
"]",
"byte",
")",
"error",
"{",
"ccm",
":=",
"enaml",
".",
"NewCloudConfigManifest",
"(",
"manifest",
")",
"\n",
"req",
",",
"err",
":=",
"s",
".",
"newCloudConfigRequest",
"(... | // PushCloudConfig uploads a cloud config to bosh. | [
"PushCloudConfig",
"uploads",
"a",
"cloud",
"config",
"to",
"bosh",
"."
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/enamlbosh/api.go#L144-L163 | test |
enaml-ops/enaml | generators/generate.go | Generate | func Generate(packagename string, fileBytes []byte, outputDir string) {
b := preprocessJobManifest(fileBytes)
objects := make(map[string]map[string]ObjectField)
var properties []string
for _, v := range b.recs {
properties = append(properties, v.Orig)
}
for i := 0; i < b.max; i++ {
for _, v := range b.recs {... | go | func Generate(packagename string, fileBytes []byte, outputDir string) {
b := preprocessJobManifest(fileBytes)
objects := make(map[string]map[string]ObjectField)
var properties []string
for _, v := range b.recs {
properties = append(properties, v.Orig)
}
for i := 0; i < b.max; i++ {
for _, v := range b.recs {... | [
"func",
"Generate",
"(",
"packagename",
"string",
",",
"fileBytes",
"[",
"]",
"byte",
",",
"outputDir",
"string",
")",
"{",
"b",
":=",
"preprocessJobManifest",
"(",
"fileBytes",
")",
"\n",
"objects",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"... | //Generate - used to generate a struct for a given job | [
"Generate",
"-",
"used",
"to",
"generate",
"a",
"struct",
"for",
"a",
"given",
"job"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/generators/generate.go#L16-L57 | test |
enaml-ops/enaml | generators/generate.go | CreateNewRecord | func CreateNewRecord(property string, yaml enaml.JobManifestProperty) (record Record) {
elementArray := strings.Split(property, ".")
record = Record{
Length: len(elementArray),
Orig: property,
Slice: elementArray,
Yaml: yaml,
}
return
} | go | func CreateNewRecord(property string, yaml enaml.JobManifestProperty) (record Record) {
elementArray := strings.Split(property, ".")
record = Record{
Length: len(elementArray),
Orig: property,
Slice: elementArray,
Yaml: yaml,
}
return
} | [
"func",
"CreateNewRecord",
"(",
"property",
"string",
",",
"yaml",
"enaml",
".",
"JobManifestProperty",
")",
"(",
"record",
"Record",
")",
"{",
"elementArray",
":=",
"strings",
".",
"Split",
"(",
"property",
",",
"\".\"",
")",
"\n",
"record",
"=",
"Record",
... | //CreateNewRecord - creates a record from a given period delimited property and enaml.JobManifestProperty | [
"CreateNewRecord",
"-",
"creates",
"a",
"record",
"from",
"a",
"given",
"period",
"delimited",
"property",
"and",
"enaml",
".",
"JobManifestProperty"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/generators/generate.go#L115-L124 | test |
enaml-ops/enaml | run/showcmd.go | NewShowCmd | func NewShowCmd(releaseRepo pull.Release, release string) *ShowCmd {
return &ShowCmd{
releaseRepo: releaseRepo,
release: release,
}
} | go | func NewShowCmd(releaseRepo pull.Release, release string) *ShowCmd {
return &ShowCmd{
releaseRepo: releaseRepo,
release: release,
}
} | [
"func",
"NewShowCmd",
"(",
"releaseRepo",
"pull",
".",
"Release",
",",
"release",
"string",
")",
"*",
"ShowCmd",
"{",
"return",
"&",
"ShowCmd",
"{",
"releaseRepo",
":",
"releaseRepo",
",",
"release",
":",
"release",
",",
"}",
"\n",
"}"
] | // NewShowCmd creates a new ShowCmd instance. | [
"NewShowCmd",
"creates",
"a",
"new",
"ShowCmd",
"instance",
"."
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/run/showcmd.go#L20-L25 | test |
enaml-ops/enaml | run/showcmd.go | All | func (s *ShowCmd) All(w io.Writer) error {
if filepath.Ext(s.release) == ".pivotal" {
pivnetRelease, err := release.LoadPivnetRelease(s.releaseRepo, s.release)
if err != nil {
return err
}
for _, br := range pivnetRelease.BoshRelease {
s.printBoshRelease(w, br)
}
return nil
}
boshRelease, err := re... | go | func (s *ShowCmd) All(w io.Writer) error {
if filepath.Ext(s.release) == ".pivotal" {
pivnetRelease, err := release.LoadPivnetRelease(s.releaseRepo, s.release)
if err != nil {
return err
}
for _, br := range pivnetRelease.BoshRelease {
s.printBoshRelease(w, br)
}
return nil
}
boshRelease, err := re... | [
"func",
"(",
"s",
"*",
"ShowCmd",
")",
"All",
"(",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"if",
"filepath",
".",
"Ext",
"(",
"s",
".",
"release",
")",
"==",
"\".pivotal\"",
"{",
"pivnetRelease",
",",
"err",
":=",
"release",
".",
"LoadPivnetRele... | // All writes out all the release data to writer. | [
"All",
"writes",
"out",
"all",
"the",
"release",
"data",
"to",
"writer",
"."
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/run/showcmd.go#L28-L45 | test |
enaml-ops/enaml | concourse.go | GetDefaultTaskImageResource | func (s *ConcoursePipeline) GetDefaultTaskImageResource() atc.ImageResource {
return atc.ImageResource{
Type: s.defaultImageType,
Source: atc.Source{
"repository": s.defaultImageRepository,
},
}
} | go | func (s *ConcoursePipeline) GetDefaultTaskImageResource() atc.ImageResource {
return atc.ImageResource{
Type: s.defaultImageType,
Source: atc.Source{
"repository": s.defaultImageRepository,
},
}
} | [
"func",
"(",
"s",
"*",
"ConcoursePipeline",
")",
"GetDefaultTaskImageResource",
"(",
")",
"atc",
".",
"ImageResource",
"{",
"return",
"atc",
".",
"ImageResource",
"{",
"Type",
":",
"s",
".",
"defaultImageType",
",",
"Source",
":",
"atc",
".",
"Source",
"{",
... | // GetDefaultTaskImageResource - convenience helper to output default object for
// task images | [
"GetDefaultTaskImageResource",
"-",
"convenience",
"helper",
"to",
"output",
"default",
"object",
"for",
"task",
"images"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/concourse.go#L27-L34 | test |
enaml-ops/enaml | concourse.go | AddRawJob | func (s *ConcoursePipeline) AddRawJob(job atc.JobConfig) {
s.Jobs = append(s.Jobs, job)
} | go | func (s *ConcoursePipeline) AddRawJob(job atc.JobConfig) {
s.Jobs = append(s.Jobs, job)
} | [
"func",
"(",
"s",
"*",
"ConcoursePipeline",
")",
"AddRawJob",
"(",
"job",
"atc",
".",
"JobConfig",
")",
"{",
"s",
".",
"Jobs",
"=",
"append",
"(",
"s",
".",
"Jobs",
",",
"job",
")",
"\n",
"}"
] | //AddRawJob helper to add a job to the pipeline manifest | [
"AddRawJob",
"helper",
"to",
"add",
"a",
"job",
"to",
"the",
"pipeline",
"manifest"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/concourse.go#L42-L44 | test |
enaml-ops/enaml | concourse.go | AddGroup | func (s *ConcoursePipeline) AddGroup(name string, jobs ...string) {
s.Groups = append(s.Groups, atc.GroupConfig{
Name: name,
Jobs: jobs,
})
} | go | func (s *ConcoursePipeline) AddGroup(name string, jobs ...string) {
s.Groups = append(s.Groups, atc.GroupConfig{
Name: name,
Jobs: jobs,
})
} | [
"func",
"(",
"s",
"*",
"ConcoursePipeline",
")",
"AddGroup",
"(",
"name",
"string",
",",
"jobs",
"...",
"string",
")",
"{",
"s",
".",
"Groups",
"=",
"append",
"(",
"s",
".",
"Groups",
",",
"atc",
".",
"GroupConfig",
"{",
"Name",
":",
"name",
",",
"... | //AddGroup helper to add a group to the pipeline manifest | [
"AddGroup",
"helper",
"to",
"add",
"a",
"group",
"to",
"the",
"pipeline",
"manifest"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/concourse.go#L47-L52 | test |
enaml-ops/enaml | concourse.go | GetResourceByName | func (s *ConcoursePipeline) GetResourceByName(name string) *atc.ResourceConfig {
for i, v := range s.Resources {
if v.Name == name {
return &s.Resources[i]
}
}
return nil
} | go | func (s *ConcoursePipeline) GetResourceByName(name string) *atc.ResourceConfig {
for i, v := range s.Resources {
if v.Name == name {
return &s.Resources[i]
}
}
return nil
} | [
"func",
"(",
"s",
"*",
"ConcoursePipeline",
")",
"GetResourceByName",
"(",
"name",
"string",
")",
"*",
"atc",
".",
"ResourceConfig",
"{",
"for",
"i",
",",
"v",
":=",
"range",
"s",
".",
"Resources",
"{",
"if",
"v",
".",
"Name",
"==",
"name",
"{",
"ret... | //GetResourceByName convenience method to find and return a resource by name | [
"GetResourceByName",
"convenience",
"method",
"to",
"find",
"and",
"return",
"a",
"resource",
"by",
"name"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/concourse.go#L62-L69 | test |
enaml-ops/enaml | concourse.go | AddRawResource | func (s *ConcoursePipeline) AddRawResource(rawResource atc.ResourceConfig) {
s.Resources = append(s.Resources, rawResource)
} | go | func (s *ConcoursePipeline) AddRawResource(rawResource atc.ResourceConfig) {
s.Resources = append(s.Resources, rawResource)
} | [
"func",
"(",
"s",
"*",
"ConcoursePipeline",
")",
"AddRawResource",
"(",
"rawResource",
"atc",
".",
"ResourceConfig",
")",
"{",
"s",
".",
"Resources",
"=",
"append",
"(",
"s",
".",
"Resources",
",",
"rawResource",
")",
"\n",
"}"
] | //AddRawResource helper to add a resource to the pipeline manifest | [
"AddRawResource",
"helper",
"to",
"add",
"a",
"resource",
"to",
"the",
"pipeline",
"manifest"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/concourse.go#L72-L74 | test |
enaml-ops/enaml | concourse.go | AddResource | func (s *ConcoursePipeline) AddResource(name string, typename string, source map[string]interface{}) {
s.Resources = append(s.Resources, atc.ResourceConfig{
Name: name,
Type: typename,
Source: source,
})
} | go | func (s *ConcoursePipeline) AddResource(name string, typename string, source map[string]interface{}) {
s.Resources = append(s.Resources, atc.ResourceConfig{
Name: name,
Type: typename,
Source: source,
})
} | [
"func",
"(",
"s",
"*",
"ConcoursePipeline",
")",
"AddResource",
"(",
"name",
"string",
",",
"typename",
"string",
",",
"source",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"s",
".",
"Resources",
"=",
"append",
"(",
"s",
".",
"Resources... | //AddResource helper to add a resource to the pipeline manifest | [
"AddResource",
"helper",
"to",
"add",
"a",
"resource",
"to",
"the",
"pipeline",
"manifest"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/concourse.go#L77-L83 | test |
enaml-ops/enaml | concourse.go | AddGithubResource | func (s *ConcoursePipeline) AddGithubResource(name string, source map[string]interface{}) {
s.AddResource(name, GithubResourceName, source)
} | go | func (s *ConcoursePipeline) AddGithubResource(name string, source map[string]interface{}) {
s.AddResource(name, GithubResourceName, source)
} | [
"func",
"(",
"s",
"*",
"ConcoursePipeline",
")",
"AddGithubResource",
"(",
"name",
"string",
",",
"source",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"s",
".",
"AddResource",
"(",
"name",
",",
"GithubResourceName",
",",
"source",
")",
"... | //AddGithubResource github specific resource add | [
"AddGithubResource",
"github",
"specific",
"resource",
"add"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/concourse.go#L86-L88 | test |
enaml-ops/enaml | concourse.go | AddBoshIOResource | func (s *ConcoursePipeline) AddBoshIOResource(name string, source map[string]interface{}) {
s.AddResource(name, BoshIOResourceName, source)
} | go | func (s *ConcoursePipeline) AddBoshIOResource(name string, source map[string]interface{}) {
s.AddResource(name, BoshIOResourceName, source)
} | [
"func",
"(",
"s",
"*",
"ConcoursePipeline",
")",
"AddBoshIOResource",
"(",
"name",
"string",
",",
"source",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"s",
".",
"AddResource",
"(",
"name",
",",
"BoshIOResourceName",
",",
"source",
")",
"... | //AddBoshIOResource bosh io specific resource add | [
"AddBoshIOResource",
"bosh",
"io",
"specific",
"resource",
"add"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/concourse.go#L91-L93 | test |
enaml-ops/enaml | concourse.go | AddBoshDeploymentResource | func (s *ConcoursePipeline) AddBoshDeploymentResource(name string, source map[string]interface{}) {
s.AddResource(name, BoshDeploymentResourceName, source)
} | go | func (s *ConcoursePipeline) AddBoshDeploymentResource(name string, source map[string]interface{}) {
s.AddResource(name, BoshDeploymentResourceName, source)
} | [
"func",
"(",
"s",
"*",
"ConcoursePipeline",
")",
"AddBoshDeploymentResource",
"(",
"name",
"string",
",",
"source",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"s",
".",
"AddResource",
"(",
"name",
",",
"BoshDeploymentResourceName",
",",
"sou... | //AddBoshDeploymentResource bosh deployment resource add | [
"AddBoshDeploymentResource",
"bosh",
"deployment",
"resource",
"add"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/concourse.go#L96-L98 | test |
enaml-ops/enaml | concourse.go | AddGitResource | func (s *ConcoursePipeline) AddGitResource(name string, source map[string]interface{}) {
s.AddResource(name, GitResourceName, source)
} | go | func (s *ConcoursePipeline) AddGitResource(name string, source map[string]interface{}) {
s.AddResource(name, GitResourceName, source)
} | [
"func",
"(",
"s",
"*",
"ConcoursePipeline",
")",
"AddGitResource",
"(",
"name",
"string",
",",
"source",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"s",
".",
"AddResource",
"(",
"name",
",",
"GitResourceName",
",",
"source",
")",
"\n",
... | //AddGitResource git specific resource add | [
"AddGitResource",
"git",
"specific",
"resource",
"add"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/concourse.go#L101-L103 | test |
enaml-ops/enaml | diff/boshreleasediffer.go | allJobNames | func (d boshReleaseDiffer) allJobNames() []string {
jobNamesMap := make(map[string]string)
var addJobNames = func(br *release.BoshRelease) {
if br != nil {
for jbname := range br.JobManifests {
jobNamesMap[jbname] = jbname
}
}
}
addJobNames(d.release1)
addJobNames(d.release2)
var jobNames []string
... | go | func (d boshReleaseDiffer) allJobNames() []string {
jobNamesMap := make(map[string]string)
var addJobNames = func(br *release.BoshRelease) {
if br != nil {
for jbname := range br.JobManifests {
jobNamesMap[jbname] = jbname
}
}
}
addJobNames(d.release1)
addJobNames(d.release2)
var jobNames []string
... | [
"func",
"(",
"d",
"boshReleaseDiffer",
")",
"allJobNames",
"(",
")",
"[",
"]",
"string",
"{",
"jobNamesMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"var",
"addJobNames",
"=",
"func",
"(",
"br",
"*",
"release",
".",
"BoshRele... | // allJobNames returns a union of unique job names across both BOSH releases | [
"allJobNames",
"returns",
"a",
"union",
"of",
"unique",
"job",
"names",
"across",
"both",
"BOSH",
"releases"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/diff/boshreleasediffer.go#L52-L68 | test |
enaml-ops/enaml | deploymentmanifest.go | NewDeploymentManifestFromFile | func NewDeploymentManifestFromFile(f *os.File) *DeploymentManifest {
var b []byte
fi, _ := f.Stat()
if fi.Size() > 0 {
b, _ = ioutil.ReadAll(f)
}
return NewDeploymentManifest(b)
} | go | func NewDeploymentManifestFromFile(f *os.File) *DeploymentManifest {
var b []byte
fi, _ := f.Stat()
if fi.Size() > 0 {
b, _ = ioutil.ReadAll(f)
}
return NewDeploymentManifest(b)
} | [
"func",
"NewDeploymentManifestFromFile",
"(",
"f",
"*",
"os",
".",
"File",
")",
"*",
"DeploymentManifest",
"{",
"var",
"b",
"[",
"]",
"byte",
"\n",
"fi",
",",
"_",
":=",
"f",
".",
"Stat",
"(",
")",
"\n",
"if",
"fi",
".",
"Size",
"(",
")",
">",
"0... | //NewDeploymentManifestFromFile - will read any implementor of os.File and
//initialize a deployment manifest from its bytes.
//this can be used to read a file or os.Stdin | [
"NewDeploymentManifestFromFile",
"-",
"will",
"read",
"any",
"implementor",
"of",
"os",
".",
"File",
"and",
"initialize",
"a",
"deployment",
"manifest",
"from",
"its",
"bytes",
".",
"this",
"can",
"be",
"used",
"to",
"read",
"a",
"file",
"or",
"os",
".",
"... | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/deploymentmanifest.go#L24-L32 | test |
enaml-ops/enaml | deploymentmanifest.go | NewDeploymentManifest | func NewDeploymentManifest(b []byte) *DeploymentManifest {
dm := new(DeploymentManifest)
yaml.Unmarshal(b, dm)
return dm
} | go | func NewDeploymentManifest(b []byte) *DeploymentManifest {
dm := new(DeploymentManifest)
yaml.Unmarshal(b, dm)
return dm
} | [
"func",
"NewDeploymentManifest",
"(",
"b",
"[",
"]",
"byte",
")",
"*",
"DeploymentManifest",
"{",
"dm",
":=",
"new",
"(",
"DeploymentManifest",
")",
"\n",
"yaml",
".",
"Unmarshal",
"(",
"b",
",",
"dm",
")",
"\n",
"return",
"dm",
"\n",
"}"
] | //NewDeploymentManifest - deployment manifest constructor | [
"NewDeploymentManifest",
"-",
"deployment",
"manifest",
"constructor"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/deploymentmanifest.go#L35-L39 | test |
enaml-ops/enaml | deploymentmanifest.go | AddRemoteRelease | func (s *DeploymentManifest) AddRemoteRelease(releaseName, ver, url, sha1 string) (err error) {
s.Releases = append(s.Releases, Release{
Name: releaseName,
URL: url,
SHA1: sha1,
Version: ver,
})
return
} | go | func (s *DeploymentManifest) AddRemoteRelease(releaseName, ver, url, sha1 string) (err error) {
s.Releases = append(s.Releases, Release{
Name: releaseName,
URL: url,
SHA1: sha1,
Version: ver,
})
return
} | [
"func",
"(",
"s",
"*",
"DeploymentManifest",
")",
"AddRemoteRelease",
"(",
"releaseName",
",",
"ver",
",",
"url",
",",
"sha1",
"string",
")",
"(",
"err",
"error",
")",
"{",
"s",
".",
"Releases",
"=",
"append",
"(",
"s",
".",
"Releases",
",",
"Release",... | //AddRemoteRelease - adds a remote release to the manifest. Url should not
//contain version information | [
"AddRemoteRelease",
"-",
"adds",
"a",
"remote",
"release",
"to",
"the",
"manifest",
".",
"Url",
"should",
"not",
"contain",
"version",
"information"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/deploymentmanifest.go#L62-L70 | test |
enaml-ops/enaml | deploymentmanifest.go | AddRemoteStemcell | func (s *DeploymentManifest) AddRemoteStemcell(os, alias, ver, url, sha1 string) {
s.Stemcells = append(s.Stemcells, Stemcell{
OS: os,
Alias: alias,
Version: ver,
URL: url,
SHA1: sha1,
})
} | go | func (s *DeploymentManifest) AddRemoteStemcell(os, alias, ver, url, sha1 string) {
s.Stemcells = append(s.Stemcells, Stemcell{
OS: os,
Alias: alias,
Version: ver,
URL: url,
SHA1: sha1,
})
} | [
"func",
"(",
"s",
"*",
"DeploymentManifest",
")",
"AddRemoteStemcell",
"(",
"os",
",",
"alias",
",",
"ver",
",",
"url",
",",
"sha1",
"string",
")",
"{",
"s",
".",
"Stemcells",
"=",
"append",
"(",
"s",
".",
"Stemcells",
",",
"Stemcell",
"{",
"OS",
":"... | // AddRemoteStemcell adds a remote stemcell to the manifest.
// The URL should not contain version information. | [
"AddRemoteStemcell",
"adds",
"a",
"remote",
"stemcell",
"to",
"the",
"manifest",
".",
"The",
"URL",
"should",
"not",
"contain",
"version",
"information",
"."
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/deploymentmanifest.go#L110-L118 | test |
enaml-ops/enaml | deploymentmanifest.go | Tag | func (s *DeploymentManifest) Tag(key string) string {
if s.Tags == nil {
return ""
}
return s.Tags[key]
} | go | func (s *DeploymentManifest) Tag(key string) string {
if s.Tags == nil {
return ""
}
return s.Tags[key]
} | [
"func",
"(",
"s",
"*",
"DeploymentManifest",
")",
"Tag",
"(",
"key",
"string",
")",
"string",
"{",
"if",
"s",
".",
"Tags",
"==",
"nil",
"{",
"return",
"\"\"",
"\n",
"}",
"\n",
"return",
"s",
".",
"Tags",
"[",
"key",
"]",
"\n",
"}"
] | // Tag gets the tag value for a specified key. | [
"Tag",
"gets",
"the",
"tag",
"value",
"for",
"a",
"specified",
"key",
"."
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/deploymentmanifest.go#L179-L184 | test |
enaml-ops/enaml | deploymentmanifest.go | RemoveTag | func (s *DeploymentManifest) RemoveTag(key string) {
if s.Tags != nil {
delete(s.Tags, key)
}
} | go | func (s *DeploymentManifest) RemoveTag(key string) {
if s.Tags != nil {
delete(s.Tags, key)
}
} | [
"func",
"(",
"s",
"*",
"DeploymentManifest",
")",
"RemoveTag",
"(",
"key",
"string",
")",
"{",
"if",
"s",
".",
"Tags",
"!=",
"nil",
"{",
"delete",
"(",
"s",
".",
"Tags",
",",
"key",
")",
"\n",
"}",
"\n",
"}"
] | // RemoveTag removes the tag with the specified key. | [
"RemoveTag",
"removes",
"the",
"tag",
"with",
"the",
"specified",
"key",
"."
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/deploymentmanifest.go#L197-L201 | test |
enaml-ops/enaml | release/pivnetrelease.go | LoadPivnetRelease | func LoadPivnetRelease(releaseRepo pull.Release, path string) (release *PivnetRelease, err error) {
release = &PivnetRelease{}
var localPath string
localPath, err = releaseRepo.Pull(path)
if err != nil {
return
}
release = &PivnetRelease{
BoshRelease: make(map[string]*BoshRelease),
}
err = release.readPivne... | go | func LoadPivnetRelease(releaseRepo pull.Release, path string) (release *PivnetRelease, err error) {
release = &PivnetRelease{}
var localPath string
localPath, err = releaseRepo.Pull(path)
if err != nil {
return
}
release = &PivnetRelease{
BoshRelease: make(map[string]*BoshRelease),
}
err = release.readPivne... | [
"func",
"LoadPivnetRelease",
"(",
"releaseRepo",
"pull",
".",
"Release",
",",
"path",
"string",
")",
"(",
"release",
"*",
"PivnetRelease",
",",
"err",
"error",
")",
"{",
"release",
"=",
"&",
"PivnetRelease",
"{",
"}",
"\n",
"var",
"localPath",
"string",
"\... | // LoadPivnetRelease creates an initialized pivnetRelease instance from the
// specified .pivotal file. | [
"LoadPivnetRelease",
"creates",
"an",
"initialized",
"pivnetRelease",
"instance",
"from",
"the",
"specified",
".",
"pivotal",
"file",
"."
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/release/pivnetrelease.go#L16-L28 | test |
enaml-ops/enaml | release/pivnetrelease.go | BoshReleaseOrEmpty | func (r *PivnetRelease) BoshReleaseOrEmpty(name string) *BoshRelease {
br := r.BoshRelease[name]
if br == nil {
br = emptyBoshRelease
}
return br
} | go | func (r *PivnetRelease) BoshReleaseOrEmpty(name string) *BoshRelease {
br := r.BoshRelease[name]
if br == nil {
br = emptyBoshRelease
}
return br
} | [
"func",
"(",
"r",
"*",
"PivnetRelease",
")",
"BoshReleaseOrEmpty",
"(",
"name",
"string",
")",
"*",
"BoshRelease",
"{",
"br",
":=",
"r",
".",
"BoshRelease",
"[",
"name",
"]",
"\n",
"if",
"br",
"==",
"nil",
"{",
"br",
"=",
"emptyBoshRelease",
"\n",
"}",... | // BoshReleaseOrEmpty returns the named BOSH release from this pivnet release
// if it exists, otherwise emptyBoshRelease is returned. | [
"BoshReleaseOrEmpty",
"returns",
"the",
"named",
"BOSH",
"release",
"from",
"this",
"pivnet",
"release",
"if",
"it",
"exists",
"otherwise",
"emptyBoshRelease",
"is",
"returned",
"."
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/release/pivnetrelease.go#L32-L38 | test |
enaml-ops/enaml | release/pivnetrelease.go | readPivnetRelease | func (r *PivnetRelease) readPivnetRelease(path string) error {
walker := pkg.NewZipWalker(path)
walker.OnMatch("releases/", func(file pkg.FileEntry) error {
br, berr := readBoshRelease(file.Reader)
if berr != nil {
return berr
}
r.BoshRelease[br.ReleaseManifest.Name] = br
return nil
})
return walker.Wa... | go | func (r *PivnetRelease) readPivnetRelease(path string) error {
walker := pkg.NewZipWalker(path)
walker.OnMatch("releases/", func(file pkg.FileEntry) error {
br, berr := readBoshRelease(file.Reader)
if berr != nil {
return berr
}
r.BoshRelease[br.ReleaseManifest.Name] = br
return nil
})
return walker.Wa... | [
"func",
"(",
"r",
"*",
"PivnetRelease",
")",
"readPivnetRelease",
"(",
"path",
"string",
")",
"error",
"{",
"walker",
":=",
"pkg",
".",
"NewZipWalker",
"(",
"path",
")",
"\n",
"walker",
".",
"OnMatch",
"(",
"\"releases/\"",
",",
"func",
"(",
"file",
"pkg... | // readPivnetRelease reads a pivnet release out of the given reader into a new
// pivnetRelease struct | [
"readPivnetRelease",
"reads",
"a",
"pivnet",
"release",
"out",
"of",
"the",
"given",
"reader",
"into",
"a",
"new",
"pivnetRelease",
"struct"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/release/pivnetrelease.go#L42-L53 | test |
enaml-ops/enaml | release/yaml.go | decodeYaml | func decodeYaml(r io.Reader, v interface{}) error {
bytes, err := ioutil.ReadAll(r)
if err == nil {
yaml.Unmarshal(bytes, v)
}
return err
} | go | func decodeYaml(r io.Reader, v interface{}) error {
bytes, err := ioutil.ReadAll(r)
if err == nil {
yaml.Unmarshal(bytes, v)
}
return err
} | [
"func",
"decodeYaml",
"(",
"r",
"io",
".",
"Reader",
",",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"bytes",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"r",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"yaml",
".",
"Unmarshal",
"(",
"byte... | // decodeYaml takes a reader to a YAML file and unmarshals it to the given struct. | [
"decodeYaml",
"takes",
"a",
"reader",
"to",
"a",
"YAML",
"file",
"and",
"unmarshals",
"it",
"to",
"the",
"given",
"struct",
"."
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/release/yaml.go#L11-L17 | test |
enaml-ops/enaml | pkg/zipwalker.go | NewZipWalker | func NewZipWalker(zipFile string) Walker {
return zipWalker{
zipPath: zipFile,
callbacks: make(map[*regexp.Regexp]WalkFunc),
}
} | go | func NewZipWalker(zipFile string) Walker {
return zipWalker{
zipPath: zipFile,
callbacks: make(map[*regexp.Regexp]WalkFunc),
}
} | [
"func",
"NewZipWalker",
"(",
"zipFile",
"string",
")",
"Walker",
"{",
"return",
"zipWalker",
"{",
"zipPath",
":",
"zipFile",
",",
"callbacks",
":",
"make",
"(",
"map",
"[",
"*",
"regexp",
".",
"Regexp",
"]",
"WalkFunc",
")",
",",
"}",
"\n",
"}"
] | // NewZipWalker creates a new Walker instance that can read a .zip stream | [
"NewZipWalker",
"creates",
"a",
"new",
"Walker",
"instance",
"that",
"can",
"read",
"a",
".",
"zip",
"stream"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/pkg/zipwalker.go#L15-L20 | test |
enaml-ops/enaml | run/diffcmd.go | NewDiffCmd | func NewDiffCmd(releaseRepo pull.Release, release1, release2 string) *DiffCmd {
return &DiffCmd{
releaseRepo: releaseRepo,
release1: release1,
release2: release2,
}
} | go | func NewDiffCmd(releaseRepo pull.Release, release1, release2 string) *DiffCmd {
return &DiffCmd{
releaseRepo: releaseRepo,
release1: release1,
release2: release2,
}
} | [
"func",
"NewDiffCmd",
"(",
"releaseRepo",
"pull",
".",
"Release",
",",
"release1",
",",
"release2",
"string",
")",
"*",
"DiffCmd",
"{",
"return",
"&",
"DiffCmd",
"{",
"releaseRepo",
":",
"releaseRepo",
",",
"release1",
":",
"release1",
",",
"release2",
":",
... | // NewDiffCmd creates a new DiffCmd instance. | [
"NewDiffCmd",
"creates",
"a",
"new",
"DiffCmd",
"instance",
"."
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/run/diffcmd.go#L20-L26 | test |
enaml-ops/enaml | run/diffcmd.go | All | func (s *DiffCmd) All(w io.Writer) error {
differ, err := diff.New(s.releaseRepo, s.release1, s.release2)
if err != nil {
return err
}
d, err := differ.Diff()
if err != nil {
return err
}
s.printDiffResult(w, d)
return nil
} | go | func (s *DiffCmd) All(w io.Writer) error {
differ, err := diff.New(s.releaseRepo, s.release1, s.release2)
if err != nil {
return err
}
d, err := differ.Diff()
if err != nil {
return err
}
s.printDiffResult(w, d)
return nil
} | [
"func",
"(",
"s",
"*",
"DiffCmd",
")",
"All",
"(",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"differ",
",",
"err",
":=",
"diff",
".",
"New",
"(",
"s",
".",
"releaseRepo",
",",
"s",
".",
"release1",
",",
"s",
".",
"release2",
")",
"\n",
"if",... | // All writes out all the differences between the specified releases | [
"All",
"writes",
"out",
"all",
"the",
"differences",
"between",
"the",
"specified",
"releases"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/run/diffcmd.go#L29-L40 | test |
enaml-ops/enaml | run/diffcmd.go | Job | func (s *DiffCmd) Job(job string, w io.Writer) error {
differ, err := diff.New(s.releaseRepo, s.release1, s.release2)
if err != nil {
return err
}
d, err := differ.DiffJob(job)
if err != nil {
return err
}
s.printDiffResult(w, d)
return nil
} | go | func (s *DiffCmd) Job(job string, w io.Writer) error {
differ, err := diff.New(s.releaseRepo, s.release1, s.release2)
if err != nil {
return err
}
d, err := differ.DiffJob(job)
if err != nil {
return err
}
s.printDiffResult(w, d)
return nil
} | [
"func",
"(",
"s",
"*",
"DiffCmd",
")",
"Job",
"(",
"job",
"string",
",",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"differ",
",",
"err",
":=",
"diff",
".",
"New",
"(",
"s",
".",
"releaseRepo",
",",
"s",
".",
"release1",
",",
"s",
".",
"relea... | // Job writes out the job differences between the specified releases | [
"Job",
"writes",
"out",
"the",
"job",
"differences",
"between",
"the",
"specified",
"releases"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/run/diffcmd.go#L43-L54 | test |
enaml-ops/enaml | diff/differ.go | New | func New(releaseRepo pull.Release, r1Path, r2Path string) (differ Differ, err error) {
if filepath.Ext(r1Path) != filepath.Ext(r2Path) {
err = fmt.Errorf("The specified releases didn't have matching file extensions, " +
"assuming different release types.")
return
}
if filepath.Ext(r1Path) == ".pivotal" {
va... | go | func New(releaseRepo pull.Release, r1Path, r2Path string) (differ Differ, err error) {
if filepath.Ext(r1Path) != filepath.Ext(r2Path) {
err = fmt.Errorf("The specified releases didn't have matching file extensions, " +
"assuming different release types.")
return
}
if filepath.Ext(r1Path) == ".pivotal" {
va... | [
"func",
"New",
"(",
"releaseRepo",
"pull",
".",
"Release",
",",
"r1Path",
",",
"r2Path",
"string",
")",
"(",
"differ",
"Differ",
",",
"err",
"error",
")",
"{",
"if",
"filepath",
".",
"Ext",
"(",
"r1Path",
")",
"!=",
"filepath",
".",
"Ext",
"(",
"r2Pa... | // New creates a Differ instance for comparing two releases | [
"New",
"creates",
"a",
"Differ",
"instance",
"for",
"comparing",
"two",
"releases"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/diff/differ.go#L18-L46 | test |
enaml-ops/enaml | generators/record.go | StructName | func (v *Record) StructName(i int, packagename string, properties []string) (structname string) {
if i > 0 {
currentNode := v.Slice[i-1]
structname = FormatName(currentNode)
if i > 1 {
parentNames := v.FindAllParentsOfSameNamedElement(currentNode, properties)
if len(parentNames) > 1 {
structname = Form... | go | func (v *Record) StructName(i int, packagename string, properties []string) (structname string) {
if i > 0 {
currentNode := v.Slice[i-1]
structname = FormatName(currentNode)
if i > 1 {
parentNames := v.FindAllParentsOfSameNamedElement(currentNode, properties)
if len(parentNames) > 1 {
structname = Form... | [
"func",
"(",
"v",
"*",
"Record",
")",
"StructName",
"(",
"i",
"int",
",",
"packagename",
"string",
",",
"properties",
"[",
"]",
"string",
")",
"(",
"structname",
"string",
")",
"{",
"if",
"i",
">",
"0",
"{",
"currentNode",
":=",
"v",
".",
"Slice",
... | //StructName - gets struct name for property | [
"StructName",
"-",
"gets",
"struct",
"name",
"for",
"property"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/generators/record.go#L6-L20 | test |
enaml-ops/enaml | generators/record.go | TypeName | func (v *Record) TypeName(i int, properties []string) (typename string) {
if i+1 < v.Length {
currentNode := v.Slice[i]
typename = "*" + FormatName(currentNode)
if i >= 1 {
parentNames := v.FindAllParentsOfSameNamedElement(currentNode, properties)
if len(parentNames) > 1 {
typename = "*" + FormatName(v... | go | func (v *Record) TypeName(i int, properties []string) (typename string) {
if i+1 < v.Length {
currentNode := v.Slice[i]
typename = "*" + FormatName(currentNode)
if i >= 1 {
parentNames := v.FindAllParentsOfSameNamedElement(currentNode, properties)
if len(parentNames) > 1 {
typename = "*" + FormatName(v... | [
"func",
"(",
"v",
"*",
"Record",
")",
"TypeName",
"(",
"i",
"int",
",",
"properties",
"[",
"]",
"string",
")",
"(",
"typename",
"string",
")",
"{",
"if",
"i",
"+",
"1",
"<",
"v",
".",
"Length",
"{",
"currentNode",
":=",
"v",
".",
"Slice",
"[",
... | //TypeName - returns valid type name for a give record | [
"TypeName",
"-",
"returns",
"valid",
"type",
"name",
"for",
"a",
"give",
"record"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/generators/record.go#L23-L37 | test |
enaml-ops/enaml | pkg/tgzwalker.go | NewTgzWalker | func NewTgzWalker(pkgReader io.Reader) Walker {
return tgzWalker{
pkgReader: pkgReader,
callbacks: make(map[*regexp.Regexp]WalkFunc),
}
} | go | func NewTgzWalker(pkgReader io.Reader) Walker {
return tgzWalker{
pkgReader: pkgReader,
callbacks: make(map[*regexp.Regexp]WalkFunc),
}
} | [
"func",
"NewTgzWalker",
"(",
"pkgReader",
"io",
".",
"Reader",
")",
"Walker",
"{",
"return",
"tgzWalker",
"{",
"pkgReader",
":",
"pkgReader",
",",
"callbacks",
":",
"make",
"(",
"map",
"[",
"*",
"regexp",
".",
"Regexp",
"]",
"WalkFunc",
")",
",",
"}",
... | // NewTgzWalker creates a new Walker instance that can read a .tgz stream | [
"NewTgzWalker",
"creates",
"a",
"new",
"Walker",
"instance",
"that",
"can",
"read",
"a",
".",
"tgz",
"stream"
] | 4f847ee10b41afca41fe09fa839cb2f6ade06fb5 | https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/pkg/tgzwalker.go#L17-L22 | test |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.