Coder Social home page Coder Social logo

fun-with-go's Introduction

fun-with-go

A personal journey of fun and experiments with the Go language.

Following are some of the functions, variables and commands that I am personally using along my journey with Go.

functions and vars

  • len(v Type) int
  • bufio.NewScanner(r io.Reader) *Scanner
  • bufio: (s *Scanner).Scan() bool
  • bufio: (s *Scanner).Text() string
  • fmt.Println(a ...interface{}) (n int, err error)
  • fmt.Sprintf(format string, a ...interface{}) string
  • strings.Join(elems []string, sep string) string
  • os.Args []string
  • os.Stdin NewFile(uintptr(syscall.Stdin), "/dev/stdin")
  • runtime.NumCPU() int
  • time.Now() Time
  • time.Since(t Time) Duration

keywords

  • break
  • case
  • chan
  • const // example: const World = "δΈ–η•Œ"
  • default
  • defer
  • else
  • for
  • func
  • go
  • if
  • import
  • interface
  • map
  • package
  • range
  • return
  • select
  • struct
  • switch
  • type // example: switch v := i.(type)
  • var

keywords pool

  • goto
  • fallthrough
  • continue

tools

  • go [command] [arguments]
  • go build [packages]
  • go doc [pkg] [methodOrField]
  • go fmt [filename]
  • go get [packages] (-v:verbose)
  • go help [keyword]
  • go run [filename]
  • go test -bench=. [filename]
  • go version

definitions

  • pointers
    • a pointer holds the memory address of a value
    • the & operator generates a pointer to its operand
    • the * operator denotes a pointer's underlying value

some common conversion characters in format strings

%d int in decimal
%x, %o, %b int in hex, oct, bin
%f, %g, %e float
%t bool
%c rune
%s string
%q quoted string, rune
%v any value
%T type
%% literal percent

helpful custom programs

nuances

type Stringer interface {
    String() string
}
type error interface {
    Error() string
}
  • there are many implementations of the io.Reader interface, including files, network connections, compressors, ciphers, and others

exercise solutions

ref blog articles

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.