_id stringlengths 2 7 | title stringlengths 1 118 | partition stringclasses 3
values | text stringlengths 52 85.5k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q16500 | leave | train | func (t *Tree) leave(n Node) {
for _, v := range t.Visitors {
v.Leave(n)
}
} | go | {
"resource": ""
} |
q16501 | Parse | train | func Parse(input string) (*Tree, error) {
t := NewTree(bytes.NewReader([]byte(input)))
return t, t.Parse()
} | go | {
"resource": ""
} |
q16502 | Parse | train | func (t *Tree) Parse() error {
go t.lex.tokenize()
for {
n, err := t.parse()
if err != nil {
return t.enrichError(err)
}
if n == nil {
break
}
t.root.Append(n)
}
t.traverse(t.root)
return nil
} | go | {
"resource": ""
} |
q16503 | parse | train | func (t *Tree) parse() (Node, error) {
tok := t.nextNonSpace()
switch tok.tokenType {
case tokenText:
return NewTextNode(tok.value, tok.Pos), nil
case tokenPrintOpen:
name, err := t.parseExpr()
if err != nil {
return nil, err
}
_, err = t.expect(tokenPrintClose)
if err != nil {
return nil, err
... | go | {
"resource": ""
} |
q16504 | NewSafeValue | train | func NewSafeValue(val Value, types ...string) SafeValue {
safeFor := make(map[string]bool)
for _, k := range types {
safeFor[k] = true
}
if v, ok := val.(SafeValue); ok {
for _, k := range v.SafeFor() {
safeFor[k] = true
}
return safeValue{safeFor, v.Value()}
}
return safeValue{safeFor, val}
} | go | {
"resource": ""
} |
q16505 | CoerceBool | train | func CoerceBool(v Value) bool {
switch vc := v.(type) {
case SafeValue:
return CoerceBool(vc.Value())
case bool:
return vc
case Boolean:
return vc.Boolean()
case uint:
return vc > 0
case uint8:
return vc > 0
case uint16:
return vc > 0
case uint32:
return vc > 0
case uint64:
return vc > 0
case ... | go | {
"resource": ""
} |
q16506 | CoerceString | train | func CoerceString(v Value) string {
switch vc := v.(type) {
case SafeValue:
return CoerceString(vc.Value())
case string:
return vc
case Stringer:
return vc.String()
case float32, float64, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64:
return fmt.Sprintf("%v", vc)
case Number:
retur... | go | {
"resource": ""
} |
q16507 | GetAttr | train | func GetAttr(v Value, attr Value, args ...Value) (Value, error) {
r := reflect.Indirect(reflect.ValueOf(v))
if !r.IsValid() {
return nil, fmt.Errorf("getattr: value does not support attribute lookup: %v", v)
}
var retval reflect.Value
switch r.Kind() {
case reflect.Struct:
strval := CoerceString(attr)
retva... | go | {
"resource": ""
} |
q16508 | IsArray | train | func IsArray(val Value) bool {
r := reflect.Indirect(reflect.ValueOf(val))
switch r.Kind() {
case reflect.Slice, reflect.Array:
return true
}
return false
} | go | {
"resource": ""
} |
q16509 | IsMap | train | func IsMap(val Value) bool {
r := reflect.Indirect(reflect.ValueOf(val))
return r.Kind() == reflect.Map
} | go | {
"resource": ""
} |
q16510 | IsIterable | train | func IsIterable(val Value) bool {
if val == nil {
return true
}
r := reflect.Indirect(reflect.ValueOf(val))
switch r.Kind() {
case reflect.Slice, reflect.Array, reflect.Map:
return true
}
return false
} | go | {
"resource": ""
} |
q16511 | Iterate | train | func Iterate(val Value, it Iteratee) (int, error) {
if val == nil {
return 0, nil
}
r := reflect.Indirect(reflect.ValueOf(val))
switch r.Kind() {
case reflect.Slice, reflect.Array:
ln := r.Len()
l := Loop{ln == 1, 1, 0}
for i := 0; i < ln; i++ {
v := r.Index(i)
brk, err := it(i, v.Interface(), l)
... | go | {
"resource": ""
} |
q16512 | Len | train | func Len(val Value) (int, error) {
if val == nil {
return 0, nil
}
r := reflect.Indirect(reflect.ValueOf(val))
switch r.Kind() {
case reflect.Slice, reflect.Array, reflect.Map:
return r.Len(), nil
}
return 0, fmt.Errorf(`stick: could not get length of %s "%v"`, r.Kind(), val)
} | go | {
"resource": ""
} |
q16513 | Equal | train | func Equal(left Value, right Value) bool {
// TODO: Stop-gap for now, this will need to be much more sophisticated.
return CoerceString(left) == CoerceString(right)
} | go | {
"resource": ""
} |
q16514 | Contains | train | func Contains(haystack Value, needle Value) (bool, error) {
res := false
_, err := Iterate(haystack, func(k Value, v Value, l Loop) (bool, error) {
if Equal(v, needle) {
res = true
return true, nil // break
}
return false, nil
})
if err != nil {
return false, err
}
return res, nil
} | go | {
"resource": ""
} |
q16515 | String | train | func (p Pos) String() string {
return fmt.Sprintf("%d:%d", p.Line, p.Offset)
} | go | {
"resource": ""
} |
q16516 | NewModuleNode | train | func NewModuleNode(name string, nodes ...Node) *ModuleNode {
return &ModuleNode{NewBodyNode(Pos{1, 0}, nodes...), nil, name}
} | go | {
"resource": ""
} |
q16517 | Append | train | func (l *BodyNode) Append(n Node) {
l.Nodes = append(l.Nodes, n)
} | go | {
"resource": ""
} |
q16518 | NewCommentNode | train | func NewCommentNode(data string, p Pos) *CommentNode {
return &CommentNode{NewTextNode(data, p), TrimmableNode{}}
} | go | {
"resource": ""
} |
q16519 | NewPrintNode | train | func NewPrintNode(exp Expr, p Pos) *PrintNode {
return &PrintNode{p, TrimmableNode{}, exp}
} | go | {
"resource": ""
} |
q16520 | NewBlockNode | train | func NewBlockNode(name string, body Node, p Pos) *BlockNode {
return &BlockNode{p, TrimmableNode{}, name, body, ""}
} | go | {
"resource": ""
} |
q16521 | String | train | func (t *BlockNode) String() string {
return fmt.Sprintf("Block(%s: %s)", t.Name, t.Body)
} | go | {
"resource": ""
} |
q16522 | NewIfNode | train | func NewIfNode(cond Expr, body Node, els Node, p Pos) *IfNode {
return &IfNode{p, TrimmableNode{}, cond, body, els}
} | go | {
"resource": ""
} |
q16523 | String | train | func (t *IfNode) String() string {
return fmt.Sprintf("If(%s: %s Else: %s)", t.Cond, t.Body, t.Else)
} | go | {
"resource": ""
} |
q16524 | All | train | func (t *IfNode) All() []Node {
return []Node{t.Cond, t.Body, t.Else}
} | go | {
"resource": ""
} |
q16525 | NewExtendsNode | train | func NewExtendsNode(tplRef Expr, p Pos) *ExtendsNode {
return &ExtendsNode{p, TrimmableNode{}, tplRef}
} | go | {
"resource": ""
} |
q16526 | NewForNode | train | func NewForNode(k, v string, expr Expr, body, els Node, p Pos) *ForNode {
return &ForNode{p, TrimmableNode{}, k, v, expr, body, els}
} | go | {
"resource": ""
} |
q16527 | String | train | func (t *ForNode) String() string {
return fmt.Sprintf("For(%s, %s in %s: %s else %s)", t.Key, t.Val, t.X, t.Body, t.Else)
} | go | {
"resource": ""
} |
q16528 | All | train | func (t *ForNode) All() []Node {
return []Node{t.X, t.Body, t.Else}
} | go | {
"resource": ""
} |
q16529 | NewIncludeNode | train | func NewIncludeNode(tmpl Expr, with Expr, only bool, pos Pos) *IncludeNode {
return &IncludeNode{pos, TrimmableNode{}, tmpl, with, only}
} | go | {
"resource": ""
} |
q16530 | String | train | func (t *IncludeNode) String() string {
return fmt.Sprintf("Include(%s with %s %v)", t.Tpl, t.With, t.Only)
} | go | {
"resource": ""
} |
q16531 | NewEmbedNode | train | func NewEmbedNode(tmpl Expr, with Expr, only bool, blocks map[string]*BlockNode, pos Pos) *EmbedNode {
return &EmbedNode{NewIncludeNode(tmpl, with, only, pos), blocks}
} | go | {
"resource": ""
} |
q16532 | String | train | func (t *EmbedNode) String() string {
return fmt.Sprintf("Embed(%s with %s %v: %v)", t.Tpl, t.With, t.Only, t.Blocks)
} | go | {
"resource": ""
} |
q16533 | All | train | func (t *EmbedNode) All() []Node {
r := t.IncludeNode.All()
for _, blk := range t.Blocks {
r = append(r, blk)
}
return r
} | go | {
"resource": ""
} |
q16534 | NewUseNode | train | func NewUseNode(tpl Expr, aliases map[string]string, pos Pos) *UseNode {
return &UseNode{pos, TrimmableNode{}, tpl, aliases}
} | go | {
"resource": ""
} |
q16535 | String | train | func (t *UseNode) String() string {
if l := len(t.Aliases); l > 0 {
keys := make([]string, l)
i := 0
for orig := range t.Aliases {
keys[i] = orig
i++
}
sort.Strings(keys)
res := make([]string, l)
for i, orig := range keys {
res[i] = orig + ": " + t.Aliases[orig]
}
return fmt.Sprintf("Use(%s ... | go | {
"resource": ""
} |
q16536 | NewSetNode | train | func NewSetNode(varName string, expr Expr, pos Pos) *SetNode {
return &SetNode{pos, TrimmableNode{}, varName, expr}
} | go | {
"resource": ""
} |
q16537 | String | train | func (t *SetNode) String() string {
return fmt.Sprintf("Set(%s = %v)", t.Name, t.X)
} | go | {
"resource": ""
} |
q16538 | NewDoNode | train | func NewDoNode(expr Expr, pos Pos) *DoNode {
return &DoNode{pos, TrimmableNode{}, expr}
} | go | {
"resource": ""
} |
q16539 | NewFilterNode | train | func NewFilterNode(filters []string, body Node, p Pos) *FilterNode {
return &FilterNode{p, TrimmableNode{}, filters, body}
} | go | {
"resource": ""
} |
q16540 | String | train | func (t *FilterNode) String() string {
return fmt.Sprintf("Filter (%s): %s", strings.Join(t.Filters, "|"), t.Body)
} | go | {
"resource": ""
} |
q16541 | NewMacroNode | train | func NewMacroNode(name string, args []string, body *BodyNode, p Pos) *MacroNode {
return &MacroNode{p, TrimmableNode{}, name, args, body, ""}
} | go | {
"resource": ""
} |
q16542 | String | train | func (t *MacroNode) String() string {
return fmt.Sprintf("Macro %s(%s): %s", t.Name, strings.Join(t.Args, ", "), t.Body)
} | go | {
"resource": ""
} |
q16543 | NewImportNode | train | func NewImportNode(tpl Expr, alias string, p Pos) *ImportNode {
return &ImportNode{p, TrimmableNode{}, tpl, alias}
} | go | {
"resource": ""
} |
q16544 | String | train | func (t *ImportNode) String() string {
return fmt.Sprintf("Import (%s as %s)", t.Tpl, t.Alias)
} | go | {
"resource": ""
} |
q16545 | NewFromNode | train | func NewFromNode(tpl Expr, imports map[string]string, p Pos) *FromNode {
return &FromNode{p, TrimmableNode{}, tpl, imports}
} | go | {
"resource": ""
} |
q16546 | String | train | func (t *FromNode) String() string {
keys := make([]string, len(t.Imports))
i := 0
for orig := range t.Imports {
keys[i] = orig
i++
}
sort.Strings(keys)
res := make([]string, len(t.Imports))
for i, orig := range keys {
if orig == t.Imports[orig] {
res[i] = orig
} else {
res[i] = orig + " as " + t.I... | go | {
"resource": ""
} |
q16547 | All | train | func (exp *FuncExpr) All() []Node {
res := make([]Node, len(exp.Args))
for i, n := range exp.Args {
res[i] = n
}
return res
} | go | {
"resource": ""
} |
q16548 | NewFuncExpr | train | func NewFuncExpr(name string, args []Expr, pos Pos) *FuncExpr {
return &FuncExpr{pos, name, args}
} | go | {
"resource": ""
} |
q16549 | String | train | func (exp *FuncExpr) String() string {
return fmt.Sprintf("FuncExpr(%s, %s)", exp.Name, exp.Args)
} | go | {
"resource": ""
} |
q16550 | String | train | func (exp *FilterExpr) String() string {
return fmt.Sprintf("FilterExpr(%s, %s)", exp.Name, exp.Args)
} | go | {
"resource": ""
} |
q16551 | NewFilterExpr | train | func NewFilterExpr(name string, args []Expr, pos Pos) *FilterExpr {
return &FilterExpr{NewFuncExpr(name, args, pos)}
} | go | {
"resource": ""
} |
q16552 | String | train | func (exp *TestExpr) String() string {
return fmt.Sprintf("TestExpr(%s, %s)", exp.Name, exp.Args)
} | go | {
"resource": ""
} |
q16553 | NewBinaryExpr | train | func NewBinaryExpr(left Expr, op string, right Expr, pos Pos) *BinaryExpr {
return &BinaryExpr{pos, left, op, right}
} | go | {
"resource": ""
} |
q16554 | String | train | func (exp *BinaryExpr) String() string {
return fmt.Sprintf("BinaryExpr(%s %s %s)", exp.Left, exp.Op, exp.Right)
} | go | {
"resource": ""
} |
q16555 | NewUnaryExpr | train | func NewUnaryExpr(op string, expr Expr, pos Pos) *UnaryExpr {
return &UnaryExpr{pos, op, expr}
} | go | {
"resource": ""
} |
q16556 | String | train | func (exp *UnaryExpr) String() string {
return fmt.Sprintf("UnaryExpr(%s %s)", exp.Op, exp.X)
} | go | {
"resource": ""
} |
q16557 | NewGetAttrExpr | train | func NewGetAttrExpr(cont Expr, attr Expr, args []Expr, pos Pos) *GetAttrExpr {
return &GetAttrExpr{pos, cont, attr, args}
} | go | {
"resource": ""
} |
q16558 | All | train | func (exp *GetAttrExpr) All() []Node {
res := []Node{exp.Cont, exp.Attr}
for _, v := range exp.Args {
res = append(res, v)
}
return res
} | go | {
"resource": ""
} |
q16559 | String | train | func (exp *GetAttrExpr) String() string {
if len(exp.Args) > 0 {
return fmt.Sprintf("GetAttrExpr(%s -> %s %v)", exp.Cont, exp.Attr, exp.Args)
}
return fmt.Sprintf("GetAttrExpr(%s -> %s)", exp.Cont, exp.Attr)
} | go | {
"resource": ""
} |
q16560 | NewTernaryIfExpr | train | func NewTernaryIfExpr(cond, tx, fx Expr, pos Pos) *TernaryIfExpr {
return &TernaryIfExpr{pos, cond, tx, fx}
} | go | {
"resource": ""
} |
q16561 | All | train | func (exp *TernaryIfExpr) All() []Node {
return []Node{exp.Cond, exp.TrueX, exp.FalseX}
} | go | {
"resource": ""
} |
q16562 | String | train | func (exp *TernaryIfExpr) String() string {
return fmt.Sprintf("%s ? %s : %v", exp.Cond, exp.TrueX, exp.FalseX)
} | go | {
"resource": ""
} |
q16563 | NewKeyValueExpr | train | func NewKeyValueExpr(k, v Expr, pos Pos) *KeyValueExpr {
return &KeyValueExpr{pos, k, v}
} | go | {
"resource": ""
} |
q16564 | String | train | func (exp *KeyValueExpr) String() string {
return fmt.Sprintf("%s: %s", exp.Key, exp.Value)
} | go | {
"resource": ""
} |
q16565 | All | train | func (exp *ArrayExpr) All() []Node {
all := make([]Node, len(exp.Elements))
for i, v := range exp.Elements {
all[i] = v
}
return all
} | go | {
"resource": ""
} |
q16566 | New | train | func New(loader Loader) *Env {
if loader == nil {
loader = &StringLoader{}
}
return &Env{loader, make(map[string]Func), make(map[string]Filter), make(map[string]Test), make([]parse.NodeVisitor, 0)}
} | go | {
"resource": ""
} |
q16567 | Execute | train | func (env *Env) Execute(tpl string, out io.Writer, ctx map[string]Value) error {
return execute(tpl, out, ctx, env)
} | go | {
"resource": ""
} |
q16568 | Parse | train | func (env *Env) Parse(name string) (*parse.Tree, error) {
return env.load(name)
} | go | {
"resource": ""
} |
q16569 | Load | train | func (l *StringLoader) Load(name string) (Template, error) {
return &stringTemplate{name, name}, nil
} | go | {
"resource": ""
} |
q16570 | Load | train | func (l *MemoryLoader) Load(name string) (Template, error) {
v, ok := l.Templates[name]
if !ok {
return nil, os.ErrNotExist
}
return &stringTemplate{name, v}, nil
} | go | {
"resource": ""
} |
q16571 | Load | train | func (l *FilesystemLoader) Load(name string) (Template, error) {
path := filepath.Join(l.rootDir, name)
f, err := os.Open(path)
if err != nil {
return nil, err
}
return &fileTemplate{name, f}, nil
} | go | {
"resource": ""
} |
q16572 | newUnexpectedTokenError | train | func newUnexpectedTokenError(actual token, expected ...tokenType) error {
return &UnexpectedTokenError{newBaseError(actual.Pos), actual, expected}
} | go | {
"resource": ""
} |
q16573 | newUnclosedTagError | train | func newUnclosedTagError(tagName string, start Pos) error {
return &UnclosedTagError{newBaseError(start), tagName}
} | go | {
"resource": ""
} |
q16574 | newUnexpectedValueError | train | func newUnexpectedValueError(tok token, expected string) error {
return &UnexpectedValueError{newBaseError(tok.Pos), tok, expected}
} | go | {
"resource": ""
} |
q16575 | TwigFilters | train | func TwigFilters() map[string]stick.Filter {
return map[string]stick.Filter{
"abs": filterAbs,
"default": filterDefault,
"batch": filterBatch,
"capitalize": filterCapitalize,
"convert_encoding": filterConvertEncoding,
"date": filterDate,
"date_modify": ... | go | {
"resource": ""
} |
q16576 | filterAbs | train | func filterAbs(ctx stick.Context, val stick.Value, args ...stick.Value) stick.Value {
n := stick.CoerceNumber(val)
if 0 == n {
return n
}
return math.Abs(n)
} | go | {
"resource": ""
} |
q16577 | filterCapitalize | train | func filterCapitalize(ctx stick.Context, val stick.Value, args ...stick.Value) stick.Value {
s := stick.CoerceString(val)
return strings.ToUpper(s[:1]) + s[1:]
} | go | {
"resource": ""
} |
q16578 | filterDefault | train | func filterDefault(ctx stick.Context, val stick.Value, args ...stick.Value) stick.Value {
var d stick.Value
if len(args) > 0 {
d = args[0]
}
if stick.CoerceString(val) == "" {
return d
}
return val
} | go | {
"resource": ""
} |
q16579 | filterLength | train | func filterLength(ctx stick.Context, val stick.Value, args ...stick.Value) stick.Value {
if v, ok := val.(string); ok {
return utf8.RuneCountInString(v)
}
l, _ := stick.Len(val)
// TODO: Report error
return l
} | go | {
"resource": ""
} |
q16580 | filterLower | train | func filterLower(ctx stick.Context, val stick.Value, args ...stick.Value) stick.Value {
return strings.ToLower(stick.CoerceString(val))
} | go | {
"resource": ""
} |
q16581 | filterTitle | train | func filterTitle(ctx stick.Context, val stick.Value, args ...stick.Value) stick.Value {
return strings.Title(stick.CoerceString(val))
} | go | {
"resource": ""
} |
q16582 | filterTrim | train | func filterTrim(ctx stick.Context, val stick.Value, args ...stick.Value) stick.Value {
return strings.TrimSpace(stick.CoerceString(val))
} | go | {
"resource": ""
} |
q16583 | filterUpper | train | func filterUpper(ctx stick.Context, val stick.Value, args ...stick.Value) stick.Value {
return strings.ToUpper(stick.CoerceString(val))
} | go | {
"resource": ""
} |
q16584 | nextToken | train | func (l *lexer) nextToken() token {
for v, ok := <-l.tokens; ok; {
l.last = v
return v
}
return l.last
} | go | {
"resource": ""
} |
q16585 | tokenize | train | func (l *lexer) tokenize() {
for l.state = lexData; l.state != nil; {
l.state = l.state(l)
}
} | go | {
"resource": ""
} |
q16586 | newLexer | train | func newLexer(input io.Reader) *lexer {
// TODO: lexer should use the reader.
i, _ := ioutil.ReadAll(input)
return &lexer{0, 0, 1, 0, string(i), make(chan token), nil, modeNormal, token{}, 0}
} | go | {
"resource": ""
} |
q16587 | emit | train | func (l *lexer) emit(t tokenType) {
val := ""
if l.pos <= len(l.input) {
val = l.input[l.start:l.pos]
}
tok := token{val, t, Pos{l.line, l.offset}}
if c := strings.Count(val, "\n"); c > 0 {
l.line += c
lpos := strings.LastIndex(val, "\n")
l.offset = len(val[lpos+1:])
} else {
l.offset += len(val)
}
... | go | {
"resource": ""
} |
q16588 | tryLexOperator | train | func (l *lexer) tryLexOperator() bool {
op := operatorMatcher.FindString(l.input[l.pos:])
if op == "" {
return false
} else if op == "%" {
// Ensure this is not a tag close token "%}".
// Go's regexp engine does not support negative lookahead.
if l.input[l.pos+1:l.pos+2] == "}" {
return false
}
} else ... | go | {
"resource": ""
} |
q16589 | parseExpr | train | func (t *Tree) parseExpr() (Expr, error) {
expr, err := t.parseInnerExpr()
if err != nil {
return nil, err
}
return t.parseOuterExpr(expr)
} | go | {
"resource": ""
} |
q16590 | parseFunc | train | func (t *Tree) parseFunc(name *NameExpr) (Expr, error) {
var args []Expr
for {
switch tok := t.peek(); tok.tokenType {
case tokenEOF:
return nil, newUnexpectedEOFError(tok)
case tokenParensClose:
// do nothing
default:
argexp, err := t.parseExpr()
if err != nil {
return nil, err
}
args... | go | {
"resource": ""
} |
q16591 | New | train | func New(loader stick.Loader) *stick.Env {
if loader == nil {
loader = &stick.StringLoader{}
}
env := &stick.Env{
Loader: loader,
Functions: make(map[string]stick.Func),
Filters: filter.TwigFilters(),
Tests: make(map[string]stick.Test),
Visitors: make([]parse.NodeVisitor, 0),
}
env.Register(N... | go | {
"resource": ""
} |
q16592 | sysGet | train | func sysGet(syscallNum uintptr, path string, name string, data []byte) (int, error) {
ptr, nbytes := bytePtrFromSlice(data)
/*
ssize_t extattr_get_file(
const char *path,
int attrnamespace,
const char *attrname,
void *data,
size_t nbytes);
ssize_t extattr_get_link(
const char *path,
int attr... | go | {
"resource": ""
} |
q16593 | sysRemove | train | func sysRemove(syscallNum uintptr, path string, name string) error {
/*
int extattr_delete_file(
const char *path,
int attrnamespace,
const char *attrname
);
int extattr_delete_link(
const char *path,
int attrnamespace,
const char *attrname
);
*/
_, _, err := syscall.Syscall(syscallNum, ui... | go | {
"resource": ""
} |
q16594 | Get | train | func Get(path, name string) ([]byte, error) {
return get(path, name, func(name string, data []byte) (int, error) {
return getxattr(path, name, data)
})
} | go | {
"resource": ""
} |
q16595 | LGet | train | func LGet(path, name string) ([]byte, error) {
return get(path, name, func(name string, data []byte) (int, error) {
return lgetxattr(path, name, data)
})
} | go | {
"resource": ""
} |
q16596 | FGet | train | func FGet(f *os.File, name string) ([]byte, error) {
return get(f.Name(), name, func(name string, data []byte) (int, error) {
return fgetxattr(f, name, data)
})
} | go | {
"resource": ""
} |
q16597 | get | train | func get(path string, name string, getxattrFunc getxattrFunc) ([]byte, error) {
const (
// Start with a 1 KB buffer for the xattr value
initialBufSize = 1024
// The theoretical maximum xattr value size on MacOS is 64 MB. On Linux it's
// much smaller at 64 KB. Unless the kernel is evil or buggy, we should nev... | go | {
"resource": ""
} |
q16598 | Set | train | func Set(path, name string, data []byte) error {
if err := setxattr(path, name, data, 0); err != nil {
return &Error{"xattr.Set", path, name, err}
}
return nil
} | go | {
"resource": ""
} |
q16599 | LSet | train | func LSet(path, name string, data []byte) error {
if err := lsetxattr(path, name, data, 0); err != nil {
return &Error{"xattr.LSet", path, name, err}
}
return nil
} | go | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.