digest_gopl

command module
v0.0.0-...-0deda60 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2020 License: MIT Imports: 6 Imported by: 0

README

  • Parameters are local variables whose value or arguments are supplied by the caller

  • An object is simply a value or variable that has methods

  • 调用方法时,编译器会自动为 receiver 做恰当的值-指针类型的隐式转换,所以可以怎么写简洁怎么来(receiver argument 和 receiver parameter 不一致,分别为 *TT 中的任意一个)

  • Like maps (make, literal) and slices(make, literal), channels (make) must be created before use

    • pointers (new(T) returns a *T; using &)
    • Functions are also reference types
  • printf

    package fmt
    func formatOneValue(x interface{}) string {
        if err, ok := x.(error); ok {
            return err.Error()
        }
        if str, ok := x.(Stringer); ok {
            return str.String()
        }
        // ...all other types...
    }
    
  • Dereference: loads the value


  • https://golang.org/doc/effective_go.html
  • https://golang.org/doc/code.html
  • Review (32)
    • basic-structure
    • assignments
    • declarations-initializations
    • pointers
    • control-flow
    • visibility-scope-lifetime
    • strings_Unicode_UTF-8_byte-slice
    • packages
    • integers
    • floating-point
    • booleans
    • complex-numbers
    • operators
    • constants
    • web
    • verb-adv
    • io
    • cmd
    • templates
    • idiomatic
    • go-toolchain
    • array
    • slice
    • maps
    • structs
    • JSON
    • functions
    • methods
    • interfaces
    • goroutine-channel
    • concurrency-shared_variables
    • testing

Continues at p348

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
tgpl
ch1/Ex1.1
Prints command-line arguments
Prints command-line arguments
ch1/Ex1.10
Fetches URLs in parallel and reports elapsed time and size; investgates caching
Fetches URLs in parallel and reports elapsed time and size; investgates caching
ch1/Ex1.10.0
Fetches URLs in parallel and reports elapsed time and size
Fetches URLs in parallel and reports elapsed time and size
ch1/Ex1.11
Fetches URLs in parallel and reports elapsed time and size; investgates caching; panic when fetch timeout
Fetches URLs in parallel and reports elapsed time and size; investgates caching; panic when fetch timeout
ch1/Ex1.12.0
A minimal "echo" server; prints incoming url path
A minimal "echo" server; prints incoming url path
ch1/Ex1.12.1
A minimal "echo" server; prints incoming url path; count request counts
A minimal "echo" server; prints incoming url path; count request counts
ch1/Ex1.12.2
A minimal "echo" server; prints headers, form data
A minimal "echo" server; prints headers, form data
ch1/Ex1.2
Prints the index and value of each of its arguments, one per line
Prints the index and value of each of its arguments, one per line
ch1/Ex1.3
Package clargs measures the different in running time between the inefficient version and the one uses `strings.Join`
Package clargs measures the different in running time between the inefficient version and the one uses `strings.Join`
ch1/Ex1.4
Prints the names of all files in which each duplicated line occurs
Prints the names of all files in which each duplicated line occurs
ch1/Ex1.4.0
Prints the names of all files in which each duplicated line occurs
Prints the names of all files in which each duplicated line occurs
ch1/Ex1.5
Generates random animations of random Lissajous figures
Generates random animations of random Lissajous figures
ch1/Ex1.6
Generates random animations of random Lissajous figures
Generates random animations of random Lissajous figures
ch1/Ex1.7
Prints the content found at a URL
Prints the content found at a URL
ch1/Ex1.7.0
Prints the content found at a URL
Prints the content found at a URL
ch1/Ex1.8
Prints the content found at a URL; prefix http:// if it's missing in url
Prints the content found at a URL; prefix http:// if it's missing in url
ch1/Ex1.9
Prints the content found at a URL; prefix http:// if it's missing in url
Prints the content found at a URL; prefix http:// if it's missing in url
ch10/jpeg
The jpeg command reads a PNG image from the standard input and writes it as a JPEG image to the standard output
The jpeg command reads a PNG image from the standard input and writes it as a JPEG image to the standard output
ch10/mandelbrot
Mandelbrot emits a PNG image of the Mandelbrot fractal.
Mandelbrot emits a PNG image of the Mandelbrot fractal.
ch11/echo
Echo prints its command-line arguments.
Echo prints its command-line arguments.
ch11/rand_test
Package word provides utilities for word games
Package word provides utilities for word games
ch11/word1
Package word provides utilities for word games
Package word provides utilities for word games
ch11/word2
Package word provides utilities for word games
Package word provides utilities for word games
ch2/Ex2.0
Prints comamnd-line arguments
Prints comamnd-line arguments
ch2/tempconv
Package tempconv performs Celsius and Fahrenheit conversions
Package tempconv performs Celsius and Fahrenheit conversions
ch3/Ex3.1
Computes an SVG rendering of a 3-D surface function
Computes an SVG rendering of a 3-D surface function
ch3/Ex3.1.0
Computes an SVG rendering of a 3-D surface function
Computes an SVG rendering of a 3-D surface function
ch3/Ex3.3
Computes an SVG rendering of a 3-D surface function
Computes an SVG rendering of a 3-D surface function
ch3/Ex3.4
Computes an SVG rendering of a 3-D surface function
Computes an SVG rendering of a 3-D surface function
ch3/Ex3.5
emits a PNG image of the Mandelbrot fractal
emits a PNG image of the Mandelbrot fractal
ch3/Ex3.5.0
emits a PNG image of the Mandelbrot fractal
emits a PNG image of the Mandelbrot fractal
ch3/string
some string utilities; check standard library for existence before using these implementations
some string utilities; check standard library for existence before using these implementations
ch4/Ex4.1
counts the number of bits that are different in 2 SHA256 hases
counts the number of bits that are different in 2 SHA256 hases
ch4/Ex4.10
Issues prints a table of Github issues matching the search terms
Issues prints a table of Github issues matching the search terms
ch4/Ex4.2
prints the SHA256 hash of its standard input by default supports a command-line flag to print the SHA384 or SHA512 hash instead
prints the SHA256 hash of its standard input by default supports a command-line flag to print the SHA384 or SHA512 hash instead
ch4/Ex4.8
computes counts of Unicode characters
computes counts of Unicode characters
ch4/Ex4.9
reports the frequency of each word in an input text file
reports the frequency of each word in an input text file
ch4/charcount
computes counts of Unicode characters
computes counts of Unicode characters
ch4/dedup
uses a map whose keys represent the set of lines that have already appeared to ensure that subsequent occurrences not printed
uses a map whose keys represent the set of lines that have already appeared to ensure that subsequent occurrences not printed
ch4/github
Package github provides a Go API for the Github issue tracker https://developer.github.com/v3/search/#search-issues
Package github provides a Go API for the Github issue tracker https://developer.github.com/v3/search/#search-issues
ch4/graph
graph maps a string to a set of related strings, its successors in a directed graph
graph maps a string to a set of related strings, its successors in a directed graph
ch4/issues
Issues prints a table of Github issues matching the search terms
Issues prints a table of Github issues matching the search terms
ch4/treesort
uses a binary tree to implement an insertion sort
uses a binary tree to implement an insertion sort
ch5/Ex5.1
prints the links in an HTML document read from standard input
prints the links in an HTML document read from standard input
ch5/Ex5.12
prints the structure of the HTML tree in outline
prints the structure of the HTML tree in outline
ch5/Ex5.4
prints the links in an HTML document read from standard input
prints the links in an HTML document read from standard input
ch5/Ex5.5
does an HTTP GET request for the HTML document url and returns the number of words and images in it
does an HTTP GET request for the HTML document url and returns the number of words and images in it
ch5/Ex5.6
Computes an SVG rendering of a 3-D surface function
Computes an SVG rendering of a 3-D surface function
ch5/Ex5.7
prints the structure of the HTML tree in outline
prints the structure of the HTML tree in outline
ch5/Ex5.8
finds the first element with the specified id attribute
finds the first element with the specified id attribute
ch5/Ex5.9
replaces each substring "$foo" within s by the text returned by f("foo")
replaces each substring "$foo" within s by the text returned by f("foo")
ch5/findlinks1
prints the links in an HTML document read from standard input
prints the links in an HTML document read from standard input
ch5/findlinks2
prints the links in an HTML document read from standard input
prints the links in an HTML document read from standard input
ch5/links
Package links provides a link-extraction function
Package links provides a link-extraction function
ch5/outline
prints the structure of the HTML tree in outline
prints the structure of the HTML tree in outline
ch5/outline2
prints the structure of the HTML tree in outline
prints the structure of the HTML tree in outline
ch5/squares
returns a function that returns the next square number each time it is called
returns a function that returns the next square number each time it is called
ch5/toposort
topological sorting.
topological sorting.
ch6/intset
https://www.youtube.com/watch?v=SYoJ6gUXZvc
https://www.youtube.com/watch?v=SYoJ6gUXZvc
ch7/eval
Package eval is an evaluator for simple arithmetic expressions
Package eval is an evaluator for simple arithmetic expressions
ch7/xmlselect
Extract and print the text found beneath certain elements in an XML document tree.
Extract and print the text found beneath certain elements in an XML document tree.
ch8/cake
Package cake provides a simulation of a concurrent cake shop with numerous parameters.
Package cake provides a simulation of a concurrent cake shop with numerous parameters.
ch8/clock1
a TCP server that periodically writes the time
a TCP server that periodically writes the time
ch8/clock2
a TCP server that periodically writes the time
a TCP server that periodically writes the time
ch8/du1
The `du1` command computes the disk usage of the files in a directory
The `du1` command computes the disk usage of the files in a directory
ch8/netcat1
a read-only TCP client
a read-only TCP client
ch8/netcat2
a read-only TCP client
a read-only TCP client
ch8/thumbnail
The thumbnail package produces thumbnail-size images from larger images.
The thumbnail package produces thumbnail-size images from larger images.
ch9/bank1
Package bank provides a concurrency-safe bank with one account.
Package bank provides a concurrency-safe bank with one account.
ch9/memo1
Package memo provide a concurrency-unsafe memorization of a function of type Func.
Package memo provide a concurrency-unsafe memorization of a function of type Func.
ch9/memotest
Package memotest provides common functions for testing various designs of the memo package.
Package memotest provides common functions for testing various designs of the memo package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL