10 examples of 'golang set' in Go

Every line of 'golang set' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Go code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
28func SetTest() {
29 si := wssAPI.NewSet()
30 si.Add("111")
31 si.Add(2)
32 fmt.Println(si.Has(3))
33 fmt.Println(si.Has(2))
34 fmt.Println(si.Has("111"))
35}
344func set(c *table.Context, done chan *table.Call, zop bool,
345 rowKey, colKey, value []byte, score int64) {
346 var err error
347 if zop {
348 if done == nil {
349 err = c.ZSet(0, rowKey, colKey, value, score, 0)
350 } else {
351 _, err = c.GoZSet(0, rowKey, colKey, value, score, 0, done)
352 }
353 } else {
354 if done == nil {
355 err = c.Set(0, rowKey, colKey, value, score, 0)
356 } else {
357 _, err = c.GoSet(0, rowKey, colKey, value, score, 0, done)
358 }
359 }
360 if err != nil {
361 fmt.Printf("Set failed: %s\n", err)
362 os.Exit(1)
363 }
364
365 if *verbose != 0 && done == nil {
366 fmt.Printf("rowKey: %2s, colKey: %s\n", string(rowKey), string(colKey))
367 }
368}
125func (v *Vec3) GenGoSet(path string) string {
126 return fmt.Sprintf("%s.Set(%g, %g, %g)", path, v.X, v.Y, v.Z)
127}
147func (v remoteUint) Set(t *eval.Thread, x uint64) {
148 v.aSet(t, x)
149}
98func (v *string_value_t) Set(t *eval.Thread, x string) {
99 *v = string_value_t(x)
100}
1798func (c *gNMIClient) Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetResponse, error) {
1799 out := new(SetResponse)
1800 err := grpc.Invoke(ctx, "/gnmi.gNMI/Set", in, out, c.cc, opts...)
1801 if err != nil {
1802 return nil, err
1803 }
1804 return out, nil
1805}
1500func (c *openConfigClient) Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetResponse, error) {
1501 out := new(SetResponse)
1502 err := grpc.Invoke(ctx, "/openconfig.OpenConfig/Set", in, out, c.cc, opts...)
1503 if err != nil {
1504 return nil, err
1505 }
1506 return out, nil
1507}
41func setSet(L *lua.LState) int {
42 return 0
43}
445func (p *valueProperty) set(this, v Value) {
446 if p.setterFunc == nil {
447 p.value = v
448 return
449 }
450 call, _ := p.setterFunc.self.assertCallable()
451 call(FunctionCall{
452 This: this,
453 Arguments: []Value{v},
454 })
455}
305func stringSliceFromGolangSet(sset map[string]struct{}) []string {
306 ls := make([]string, 0, len(sset))
307 for s := range sset {
308 ls = append(ls, s)
309 }
310
311 return ls
312}

Related snippets