10 examples of 'golang uint' in Go

Every line of 'golang uint' 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
this disclaimer
1596func (a Uint32Attr) Uint() uint32 {
1597 return uint32(a)
1598}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

652func (af AddressFamily) Uint() uint8 {
653 return uint8(af)
654}
220func (c Column) UintType() bool { return c.Type >= field.TypeUint8 && c.Type <= field.TypeUint64 }
16func Uint(val uint, arr []uint) bool {
17 for _, a := range arr {
18 if a == val {
19 return true
20 }
21 }
22 return false
23}
11func UInt(in uint) uint {
12 return in * 2
13}
19func (s *StringNumber) Uint() uint {
20 return uint(s.Int())
21}
42func writeUint(out io.Writer, v uint64) {
43 for v > 0x7f {
44 writeByte(out, byte(v&0x7f|0x80))
45 v >>= 7
46 }
47 writeByte(out, byte(v))
48}
361func (v *Value) castToUint(t reflect.Type, path path) (reflect.Value, error) {
362 if v.Kind != Uint {
363 return reflect.Value{}, &TypeMismatch{
364 val: v,
365 t: t,
366 path: path,
367 }
368 }
369 return reflect.ValueOf(uint(v.Uint)), nil
370}
274func (s *Stream) uint(maxbits int) (uint64, error) {
275 kind, size, err := s.Kind()
276 if err != nil {
277 return 0, err
278 }
279 switch kind {
280 case Byte:
281 if s.byteval == 0 {
282 return 0, ErrCanonInt
283 }
284 s.kind = -1
285 return uint64(s.byteval), nil
286 case String:
287 if size > uint64(maxbits / 8) {
288 return 0, errUintOverflow
289 }
290 v, err := s.readUint(byte(size))
291 switch {
292 case err == ErrCanonSize:
293 return 0, ErrCanonInt
294 case err != nil:
295 return 0, err
296 case size > 0 && v < 128:
297 return 0, ErrCanonSize
298 default:
299 return v, nil
300 }
301 default:
302 return 0, ErrExpectedString
303 }
304}
94func Uint(from interface{}) (uint, error) {
95 return converter.Uint(from)
96}

Related snippets