Code Monkey home page Code Monkey logo

gobyexample's People

Contributors

3ks avatar adam-singer avatar akagi201 avatar brandony avatar brandur avatar carsonmcdonald avatar castlebin avatar catsby avatar cespare avatar danp avatar everyx avatar imane0897 avatar jakejscott avatar jaywgraves avatar jpfuentes2 avatar lispython avatar mahuihuang avatar minikomi avatar mmcgrana avatar nikai3d avatar owenthereal avatar schezuk avatar stroborobo avatar taiojia avatar timzchen avatar xg-wang avatar yangy2000 avatar yanyixing avatar zakj avatar zwfang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gobyexample's Issues

window下构建项目问题。

系统win10,使用 go get github.com/russross/blackfriday 构建项目,目录下没有 tools文件夹。


建议修改readme,做相应说明。

关于"临时文件和目录"无法删除tempfile

问题描述:
执行"临时文件和目录"代码时,会存在这样的error:The process cannot access the file because it is being used by another process.
首先代码如网站描述:

func check(e error) {
    if e != nil {
        panic(e)
    }
}

func main() {

    f, err := os.CreateTemp("", "sample")
    check(err)

    fmt.Println("Temp file name:", f.Name())

    defer os.Remove(f.Name())

    _, err = f.Write([]byte{1, 2, 3, 4})
    check(err)
}

在这个过程中并不能删掉所创建的临时文件,因为此时*File未关闭(造成存在一个process 正在访问file),导致os.Remove()无法访问,进行删除。
故应该修改为:

func check(e error) {
    if e != nil {
        panic(e)
    }
}

func main() {

    f, err := os.CreateTemp("", "sample")
    check(err)

    fmt.Println("Temp file name:", f.Name())

    defer os.Remove(f.Name())
    defer f.Close()
    _, err = f.Write([]byte{1, 2, 3, 4})
    check(err)
}

语法问题

image
这里不包含下标为5的元素 在切片那一页
image
image

sorting-by-functions

This is not a issue!
I just want to say that we have an easier way to implement sorting-by-functions like this:

import (
	"fmt"
	"sort"
)

func main() {
	fruits := []string{"peach", "banana", "kiwi"}
	sort.Slice(fruits, func(i, j int) bool {
		return len(fruits[i]) < len(fruits[j])
	})
	fmt.Println(fruits)
}

"file does not exit" error on windows, while english version is ok to run

Thank you for the translation, they are so great!

When I build it locally, I come to the following file missing error, while the file is actually at that certain place. I noticed the code to call this file is the same, which is tools/generate.go, with English version, and I could compile correctly in original English version, so I'm not so sure where this problem come from.

error info

panic: exec: "./vendor/pygments/pygmentize": file does not exist

goroutine 1 [running]:
main.check(...)
        C:/somepath/gobyexample/tools/generate.go:32
main.pipe(0x7c1fa5, 0x1c, 0xc000079c90, 0x4, 0x4, 0xc00023c07b, 0xc, 0x7b8c03, 0x1, 0xc00020a510)
        C:/somepath/gobyexample/tools/generate.go:55 +0x300
main.cachedPygmentize(0x7b8d14, 0x2, 0xc00023c07b, 0xc, 0xc000248100, 0x7b)
        C:/somepath/gobyexample/tools/generate.go:88 +0x2cb
main.parseAndRenderSegs(0xc00022e100, 0x19, 0x5, 0x0, 0x4, 0x0, 0x0)
        C:/somepath/gobyexample/tools/generate.go:225 +0x13f
main.parseExamples(0x7c01cb, 0x17, 0xc0000106c0)
        C:/somepath/gobyexample/tools/generate.go:271 +0x918
main.main()
        C:/somepath/gobyexample/tools/generate.go:334 +0x303
exit status 2

Environment

System: Windows10 Pro
Bash: Git Bash

timeouts这章的go文件和html好像有点对不上

RT
使用这个 select 超时方式,需要使用通道传递结果。这对于一班情况是个好的方式,因为其他重要的 Go 特性是基于通道和select 的。接下来我们就要看到两个例子:timer 和 ticker。
这段在go文件里木有

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.