Skip to content
This repository was archived by the owner on Jul 29, 2021. It is now read-only.

Commit fb3b0cc

Browse files
committed
wip
1 parent cbc359b commit fb3b0cc

File tree

6 files changed

+152
-108
lines changed

6 files changed

+152
-108
lines changed

examples/build/README.md

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -155,27 +155,29 @@ only when building the package for 32-bit x86.
155155
``` go
156156
var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
157157
```
158-
159158
ToolDir is the directory containing build tools.
160159

161160

162161
## func ArchChar
163-
<pre>func ArchChar(goarch string) (string, error)</pre>
162+
``` go
163+
func ArchChar(goarch string) (string, error)
164+
```
164165
ArchChar returns the architecture character for the given goarch.
165166
For example, ArchChar("amd64") returns "6".
166167

167168

168-
169169
## func IsLocalImport
170-
<pre>func IsLocalImport(path string) bool</pre>
170+
``` go
171+
func IsLocalImport(path string) bool
172+
```
171173
IsLocalImport reports whether the import path is
172174
a local import path, like ".", "..", "./foo", or "../foo".
173175

174176

175177

176-
177178
## type Context
178-
<pre>type Context struct {
179+
``` go
180+
type Context struct {
179181
GOARCH string // target architecture
180182
GOOS string // target operating system
181183
GOROOT string // Go root
@@ -234,7 +236,8 @@ a local import path, like ".", "..", "./foo", or "../foo".
234236
// OpenFile opens a file (not a directory) for reading.
235237
// If OpenFile is nil, Import uses os.Open.
236238
OpenFile func(path string) (r io.ReadCloser, err error)
237-
}</pre>
239+
}
240+
```
238241
A Context specifies the supporting context for a build.
239242

240243

@@ -244,7 +247,6 @@ A Context specifies the supporting context for a build.
244247
``` go
245248
var Default Context = defaultContext()
246249
```
247-
248250
Default is the default Context for builds.
249251
It uses the GOARCH, GOOS, GOROOT, and GOPATH environment variables
250252
if set, or else the compiled code's GOARCH, GOOS, and GOROOT.
@@ -312,7 +314,9 @@ that do not exist.
312314

313315

314316
## type ImportMode
315-
<pre>type ImportMode uint</pre>
317+
``` go
318+
type ImportMode uint
319+
```
316320
An ImportMode controls the behavior of the Import method.
317321

318322

@@ -338,11 +342,12 @@ const (
338342

339343

340344

341-
342345
## type NoGoError
343-
<pre>type NoGoError struct {
346+
``` go
347+
type NoGoError struct {
344348
Dir string
345-
}</pre>
349+
}
350+
```
346351
NoGoError is the error used by Import to describe a directory
347352
containing no buildable Go source files. (It may still contain
348353
test files, files hidden by build tags, and so on.)
@@ -365,7 +370,8 @@ test files, files hidden by build tags, and so on.)
365370

366371

367372
## type Package
368-
<pre>type Package struct {
373+
``` go
374+
type Package struct {
369375
Dir string // directory containing package sources
370376
Name string // package name
371377
Doc string // documentation synopsis
@@ -409,7 +415,8 @@ test files, files hidden by build tags, and so on.)
409415
XTestGoFiles []string // _test.go files outside package
410416
XTestImports []string // imports from XTestGoFiles
411417
XTestImportPos map[string][]token.Position // line information for XTestImports
412-
}</pre>
418+
}
419+
```
413420
A Package describes the Go package found in a directory.
414421

415422

@@ -421,16 +428,16 @@ A Package describes the Go package found in a directory.
421428

422429

423430
### func Import
424-
425-
func Import(path, srcDir string, mode ImportMode) (*Package, error)
426-
431+
``` go
432+
func Import(path, srcDir string, mode ImportMode) (*Package, error)
433+
```
427434
Import is shorthand for Default.Import.
428435

429436

430437
### func ImportDir
431-
432-
func ImportDir(dir string, mode ImportMode) (*Package, error)
433-
438+
``` go
439+
func ImportDir(dir string, mode ImportMode) (*Package, error)
440+
```
434441
ImportDir is shorthand for Default.ImportDir.
435442

436443

examples/fs/README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ Package fs provides filesystem-related functions.
1111

1212

1313
## type FileSystem
14-
<pre>type FileSystem interface {
14+
``` go
15+
type FileSystem interface {
1516

1617
// ReadDir reads the directory named by dirname and returns a
1718
// list of directory entries.
@@ -28,7 +29,8 @@ Package fs provides filesystem-related functions.
2829
//
2930
// The separator is FileSystem specific.
3031
Join(elem ...string) string
31-
}</pre>
32+
}
33+
```
3234
FileSystem defines the methods of an abstract filesystem.
3335

3436

@@ -43,9 +45,11 @@ FileSystem defines the methods of an abstract filesystem.
4345

4446

4547
## type Walker
46-
<pre>type Walker struct {
48+
``` go
49+
type Walker struct {
4750
// contains filtered or unexported fields
48-
}</pre>
51+
}
52+
```
4953
Walker provides a convenient interface for iterating over the
5054
descendants of a filesystem path.
5155
Successive calls to the Step method will step through each
@@ -63,16 +67,16 @@ Walker does not follow symbolic links.
6367

6468

6569
### func Walk
66-
67-
func Walk(root string) *Walker
68-
70+
``` go
71+
func Walk(root string) *Walker
72+
```
6973
Walk returns a new Walker rooted at root.
7074

7175

7276
### func WalkFS
73-
74-
func WalkFS(root string, fs FileSystem) *Walker
75-
77+
``` go
78+
func WalkFS(root string, fs FileSystem) *Walker
79+
```
7680
WalkFS returns a new Walker rooted at root on the FileSystem fs.
7781

7882

0 commit comments

Comments
 (0)