package main
import (
"fmt"
"example/user/hello/morestrings"
"github.com/google/go-cmp/cmp"
)
func main() {
fmt.Println(morestrings.ReverseRunes("!oG ,olleH"))
fmt.Println(cmp.Diff("Hello World", "Hello Go"))
}
$ go mod tidy
go: finding module for package github.com/google/go-cmp/cmp
go: found github.com/google/go-cmp/cmp in github.com/google/go-cmp v0.5.4
$ go install example/user/hello
$ hello
Hello, Go!
string(
- "Hello World",
+ "Hello Go",
)
$ cat go.mod
module example/user/hello
go 1.16
require github.com/google/go-cmp v0.5.4
$
$ go clean -modcache
$
Recommend
How to Write Go Code Your first program Importing packages from your module
How to Write Go Code Your first program
The Go Programming Language Specification System considerations Size and alignment guarantees
The Go Programming Language Specification System considerations Package unsafe
The Go Programming Language Specification Run-time panics
The Go Programming Language Specification Errors
The Go Programming Language Specification Program initialization and execution Program execution
The Go Programming Language Specification Program initialization and execution The zero value
The Go Programming Language Specification Packages An example package
The Go Programming Language Specification Packages Import declarations
The Go Programming Language Specification Packages Package clause
The Go Programming Language Specification Packages Source file organization
The Go Programming Language Specification Built-in functions Bootstrapping
The Go Programming Language Specification Built-in functions Handling panics
The Go Programming Language Specification Built-in functions Manipulating complex numbers
The Go Programming Language Specification Built-in functions Deletion of map elements
The Go Programming Language Specification Built-in functions Appending to and copying slices
The Go Programming Language Specification Built-in functions Making slices, maps and channels
The Go Programming Language Specification Built-in functions Allocation
The Go Programming Language Specification Built-in functions Length and capacity
The Go Programming Language Specification Statements Defer statements
The Go Programming Language Specification Statements Fallthrough statements
The Go Programming Language Specification Statements Goto statements
The Go Programming Language Specification Statements Continue statements
The Go Programming Language Specification Statements Break statements
The Go Programming Language Specification Statements Return statements
The Go Programming Language Specification Statements Select statements
The Go Programming Language Specification Statements Go statements
The Go Programming Language Specification Statements For statements For statements with range clause
The Go Programming Language Specification Statements For statements For statements with for clause
The Go Programming Language Specification Statements For statements
The Go Programming Language Specification Statements Switch statements Type switches
The Go Programming Language Specification Statements Switch statements Expression switches
The Go Programming Language Specification Statements Switch statements
The Go Programming Language Specification Statements If statements
The Go Programming Language Specification Statements Assignments
The Go Programming Language Specification Statements IncDec statements