mikespook / learning-go-zh-cn Goto Github PK
View Code? Open in Web Editor NEW一本学习 Go 语言的免费电子书。
Home Page: http://mikespook.com/learning-go/
License: Other
一本学习 Go 语言的免费电子书。
Home Page: http://mikespook.com/learning-go/
License: Other
系统是ubuntu 12.04,编译完了,发现所有的英文字符都没了。只能看到中文字符
而且似乎没有结束 无法看懂。。
请问我该怎么才能做成pdf版本?
原来代码是这样:
a := [2][2]int{ {1,2}, {3,4} }
但是哪个 2
和哪个对应就存在问题了... 建议换掉一个 2
虽然测试代码显示前边的 2
对应外层花括号
windows make命令使用不了,没有make这个命令
请核实
cosmo:mmark cosmo$ make 2.0.46 go build
cosmo:mmark cosmo$ ls LICENSE internal mmark.go rfc Makefile mast mmark_man_test.go rfc_test.go README.md mmark mmark_markdown_test.go schema Syntax.md mmark.1 mmark_test.go testdata go.mod mmark.1.docheader mparser version.go go.sum mmark.1.md render
bin下面找了也没有
然后我又执行了一下生成的mmark没有反应
vim vimLearning-Go-zh-cn/ex-basics/src/fizzbuzz.go, then I found:
const (
FIZZ = 3 |\longremark{为了提高代码的可读性,定义两个常量。%
参阅``\titleref{sec:constants}'';}|
BUZZ = 5
)
And how to use |\longremark{ }| ?
In my compiler, the following Enone/Einvalid are marked as RED, and cannot pass compile. I think the arr and sl shall not include them, and in map they shall be string? or you want to show other thing here?
arr := [...]string{Enone: "no error", Einvalid:"invalid argument"}
sl :=[]string{Enone: "no error", Einvalid:"invalid argument"}
ma :=map[int]string{Enone: "no error", Einvalid:"invalid argument"}
在ubuntu环境下, go version go1.2.1 linux/386, 执行go get github.com/mmarkdown/mmark报错:flag.CommandLine.Output undefined (type *flag.FlagSet has no field or method Output)
很奇怪现在Golang都是1.12.4版本了,为啥我的ubuntu 重新apt-get的版本还是1.2.1?
你好,我对go语言很感兴趣,想学习一下 plan9的汇编器和编译器,但是看完plan9首页的文档以后还是比较懵,现在看一些汇编的代码有一些命令总是查不到,比如MOVOU这样的,还有一些语法什么的,我能从哪里获取更丰富的文档么,我的汇编学的不多,勉勉强强在看得懂一些代码,能从哪里补充这些汇编的知识么?
这一题的答案在这里:
https://github.com/mikespook/Learning-Go-zh-cn/blob/master/ex-channels/src/for-quit-chan.go
它的代码是这样的:
func main() {
ch := make(chan int)
quit := make(chan bool)
go shower(ch, quit)
for i := 0; i < 10; i++ {
ch <- i
}
quit <- false // 或者是 true,这没啥关系
}
func shower(c chan int, quit chan bool) {
for {
select {
case j := <-c:
fmt.Printf("%d\n", j)
case <-quit:
break
}
}
}
main 程序在将false
写入quit
channel后就退出了,此时是不是仍然有可能shower
Goroutine 没有从quit
中接收到值,整个程序已经结束了。
我感觉这个逻辑应该是show
Goroutine 写入值到quit
channel中,然后main再等待结束吧。
package main
import "fmt"
func show(ch chan int, quit chan bool) {
for {
val, ok := <-ch
if !ok {
break
}
fmt.Println("Get the", val)
}
quit <- true
}
func main() {
ch := make(chan int)
quit := make(chan bool)
go show(ch, quit)
for i := 0; i < 10; i++ {
ch <- i
}
close(ch)
<-quit
}
在README.md最后的Learning Go链接失效了。
func fibonacci(value int) []int {
x := make([]int, value)
x[0], x[1] = 1, 1
for n := 2; n < value; n++ {
x[n] = x[n-1] + x[n-2]
}
return x
}
原函数在参数为1
时会报错
func fibonacci(n int) []int {
arr := make([]int, n)
a, b := 0, 1
for i := 0; i < n; i++ {
a, b = b, a+b
arr[i] = a
}
return arr
}
参考了:fib.go
it will be better if change the line 7 in ex-basics/src/stringrev.go
a := []byte(s) |\coderemark{Again a conversion}|
to
a := []rune(s) |\coderemark{Again a conversion}|
看了看,这太简单了吧。我已经手写了一个python版的,稍后改为go版本,如果提交一个完整版本的逆波兰式代码是提交到这里吗?还是提交英文版的这里( https://github.com/miekg/learninggo )
下载链接都失效了
很喜欢这个项目,我正在通过它来学习Go语言,非常感谢你的无私奉献!
有一个问题困挠我,我发现项目中的关键字都使用保留字作为翻译。我的理解是关键字是正在使用的保留字,而保留字更倾向于现在未使用留待将来扩展的字。
是否将其翻译为“关键字”更为得当呢?个人愚见,如有不妥望指正!
编译之后的 html 打开只有前言和基础的一部分,看代码,master 分支中 md 文件也只有这两个,是文件删了还是我打开方式不对?
如题
Hi there ,
I try to make this project to get the file of learninggo.html as it is from ots makefile . But, after i downloaded and did a make with a failed output as follows .
BR
Michael
DATE:2018-12-23
======
C:\Learning-Go-zh-cn>make
mmark -html -head inc/head.html -css inc/book.css learninggo.md > learninggo.html
767 [main] make 5952 fork: child 20552 - died waiting for dll loading, errno 11
make: fork: Resource temporarily unavailable
C:\Learning-Go-zh-cn>dir
Volume in drive C is Windows
Volume Serial Number is 76ED-D0DB
Directory of C:\Learning-Go-zh-cn
12/23/2018 08:31 PM
.C:\Learning-Go-zh-cn>
\begin{lstlisting}
f, err := os.Open(name, os.O_RDONLY, 0)
if err != nil {
return err
}
此处 os.Open 的参数应该只有一个
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.