Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3ef350e

Browse files
committedJun 7, 2018
init commit
1 parent 148fd4f commit 3ef350e

24 files changed

+6197
-0
lines changed
 

‎LICENSE

Lines changed: 437 additions & 0 deletions
Large diffs are not rendered by default.

‎Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.PHONY: toc
2+
3+
toc:
4+
docker run --rm -it -v ${PWD}:/usr/src jorgeandrada/doctoc --github
5+
$(shell tail -n +`grep -n '# \`go-internals\`' README.md | tr ':' ' ' | awk '{print $$1}'` README.md > /tmp/README2.md)
6+
cp /tmp/README2.md README.md

‎README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# `go-internals`
2+
3+
`go-internals` is a work-in-progress book about the internals of the Go (1.10+) programming language.
4+
5+
---
6+
7+
## Table of Contents
8+
9+
- [Chapter I: A Primer on Go Assembly](./chapter1_assembly_primer/README.md)
10+
- [Chapter II: Interfaces](./chapter2_interfaces/README.md)
11+
- [Chapter III (soon!): The Garbage Collector](./chapter3_garbage_collector/README.md)
12+
13+
---
14+
15+
## Goals
16+
17+
- **Concise**: The book aims to be as concise as possible, encouraging code and diagrams over lengthy prose.
18+
- **Community-effort**: I myself am learning as I go through the writing of this book. I *will* make mistakes along the way. Hopefully the community can help in pointing out and correcting these mistakes.
19+
- **Beyond the theory**: The book will not just cover the theory, but the actual implementation too. Assumptions will be proven or invalidated via experiments and measurements.
20+
- **Up-to-Date**: The book will try to keep up-to-date with new Go versions being released.
21+
- **Experienced audience**: The Go community has created *loads* of great introductory material for newcomers. Unfortunately we're still lacking good resources when it comes to the more advanced stuff. This books hopes to help solve this issue.
22+
23+
## Contributing
24+
25+
All kinds of contributions are very much welcome.
26+
27+
Don't hesitate to open an issue for e.g...:
28+
- pointing out technical or english mistakes
29+
- suggesting improvements and/or additions to existing chapters
30+
- suggesting external links that might be of interest
31+
- ..and pretty much anything else you can think of, really!
32+
33+
## Author
34+
35+
Clement Rey <<cr.rey.clement@gmail.com>> ([@teh_cmc](https://twitter.com/teh_cmc))
36+
37+
## License
38+
39+
Licensed under the [BY-NC-SA Creative Commons 4.0 International Public License](http://creativecommons.org/licenses/by-nc-sa/4.0/)

‎chapter1_assembly_primer/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
GOOS=linux
2+
GOARCH=amd64
3+
4+
SOURCES := $(wildcard *.go)
5+
OBJECTS = $(SOURCES:.go=.o)
6+
EXECUTABLES = $(OBJECTS:.o=.bin)
7+
8+
.SECONDARY: ${OBJECTS}
9+
10+
all: ${EXECUTABLES}
11+
12+
%.o: %.go
13+
GOOS=${GOOS} GOARCH=${GOARCH} go tool compile $<
14+
15+
%.bin: %.o
16+
GOOS=${GOOS} GOARCH=${GOARCH} go tool link -o $@ $<
17+
18+
clean:
19+
rm -f ${OBJECTS}
20+
rm -f ${EXECUTABLES}

‎chapter1_assembly_primer/README.md

Lines changed: 425 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package main
2+
3+
//go:noinline
4+
func add(a, b int32) (int32, bool) { return a + b, true }
5+
6+
func main() { add(10, 32) }

‎chapter2_interfaces/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
GOOS=linux
2+
GOARCH=amd64
3+
4+
SOURCES := $(wildcard *.go)
5+
OBJECTS = $(SOURCES:.go=.o)
6+
EXECUTABLES = $(OBJECTS:.o=.bin)
7+
8+
.SECONDARY: ${OBJECTS}
9+
10+
all: ${EXECUTABLES}
11+
12+
%.o: %.go
13+
GOOS=${GOOS} GOARCH=${GOARCH} go tool compile $<
14+
15+
%.bin: %.o
16+
GOOS=${GOOS} GOARCH=${GOARCH} go tool link -o $@ $<
17+
18+
clean:
19+
rm -f ${OBJECTS}
20+
rm -f ${EXECUTABLES}

0 commit comments

Comments
 (0)
Please sign in to comment.