Interface of Go language foundation

The interface defines the behavior specification of an object. The interface only defines that the specification is not implemented, and the specific object implements the details of the specification. 1.1 interface type In Go language, interface is a type, an abstract type. interface is a set of method s, which is an embodiment of duck type p ...

Posted by kjharve on Thu, 06 Feb 2020 01:31:18 -0800

Only 180 lines of code are needed to develop blockchain with Go language

What language does blockchain development use? Through this article, you will use go language to develop your own blockchain (or build blockchain with go language), understand how hash function keeps the integrity of blockchain, master how to create and add new blocks with go language programming, realize multiple nodes to generate blocks th ...

Posted by chalexan on Mon, 03 Feb 2020 05:13:46 -0800

Gorang learning series - 20. Package

Catalog   1, Standard library 1. regexp package: regular expression 2. sync package: lock and sync 2.1 sync.Mutex mutex 2.2 sync.RWMutex read / write lock 2.3 once.Do(call) 2, Use of packages 1. Custom package 2. reference package 3. Initialization of package 1, Standard library Built i ...

Posted by unbreakable9 on Fri, 17 Jan 2020 04:15:47 -0800

[Environment] go mod--a love-hate package management tool

Why do we need package management Python has pip, Nodejs has npm.Is there a package management tool in other languages, so go needs it?Of course not, let's look at the following code: import ( "github.com/TomatoMr/something" ) This is how go references packages, which is obviously a third-party package, so how exactly is it found on our m ...

Posted by bdbush on Tue, 14 Jan 2020 09:18:17 -0800

Program control of go

The program control of go is roughly divided into three if for case statements 1. if loop There can be any number of else if between if else statements.The order of condition judgment is from top to bottom. If the if or else if condition determines that the result is true, the corresponding code block is executed. If no condition is true, the ...

Posted by Blockis on Sat, 11 Jan 2020 06:27:18 -0800

JWT realizes authorization authentication

Catalog 1, What is JWT 2, JWT Standard Specification 3, Analysis of core code 4, Login authorization example 5, JWT usage 6, JWT considerations 1, What is JWT JSON Web Token (JWT) is the most popular cross domain authentication solution. In short, OAuth is a kind of authoriz ...

Posted by w4designs on Wed, 08 Jan 2020 08:10:31 -0800

fmt.Printf of Golang Foundation

background When printing in go language, we often see different printing methods, such as println, fmt.Println and fmt.Printf Differences and usage Source code of fmt.Println // Println formats using the default formats for its operands and writes to standard output. // Spaces are always added between operands and a newline is appended. ...

Posted by Byron on Wed, 08 Jan 2020 07:18:43 -0800

Notes on golang slice

1 slice initialization 1 func printSlice(s []int) { 2 fmt.Printf("len=%d cap=%d underlying array:%p, %v\n", len(s), cap(s), s, s) 3 } 4 5 func sliceInit() { 6 7 var s1 []int //Declare s1, and it is not initialized. At this time, s1 is nil slice, and the underlying array is not allocated 8 if s1 == nil { 9 fmt.P ...

Posted by Imad on Tue, 07 Jan 2020 02:09:49 -0800

Using Go language to operate MySQL database

Recently, I learned to use Go language to operate MySQL database to add, delete, modify and query user data when I was doing the registration and login service. Now I summarize my personal learning experience as follows, and attach Code warehouse address Welcome to fork. Software environment: Goland, Navicat for MySQL. 1, Realization ideas 1 ...

Posted by Potatis on Sat, 04 Jan 2020 03:05:34 -0800

Go Base Slices

Section Slice is a variable-length sequence of elements of the same type.It is a layer of encapsulation based on the type of array.Support automatic expansion Slice is a reference type The internal structure of the slice contains address, length, and capacity var name []T func main() { var a []string // Declare a String Slice ...

Posted by le007 on Fri, 27 Dec 2019 21:41:16 -0800