Go语言中文网 为您找到相关结果 469

What's the most idiomatic API example for an enterprise golang server?

<p>&#34;Most idiomatic&#34; is subjective--and that&#39;s fine. What do you think is the most idiomatic golang server example on the internet? I&#39;m wanting to follow idiomatic patterns for the cli (spf13/cobra ?), for logging (logrus ?), for routing (net/http ?), middleware (std lib ?), for dockerizing (from scratch ?) etc....阅读全文

从 golang flag 迁移到 cmdr

基于 cmdr v1.0.306 - Migrating from flag 采用一个新的命令行解释器框架,最痛苦地莫过于编写数据结构或者流式定义了。我们首先回顾一下 cmdr 和其它大多数三方增强命令行解释器都支持的最典型的两种命令行界面定义方式,然后再来研究一下 cmdr 新增的最平滑的迁移方案。 典型的方式 通过结构数据体定义 有的增强工具(例如 cobra,viper)采用结构体数据定义方式来完成界面指定,如同 cmdr 的这样: rootCmd = &cmdr.RootCommand{ Command: cmdr.Command{ BaseOpt: cmdr.BaseOpt{ Name: appName, Description: desc, LongDescription: lo...阅读全文

博文 2019-07-24 17:33:47 banlyst

Is it possible to bundle other executables, C libraries, SQLite databases, etc with a Golang binary?

<p>One of the things that appeals to me about Go is the ability to ship a single self-reliant binary, sparing my users a lot of hassle and avoiding a lot of minor problems.</p> <p>Right now I&#39;m writing a tool that relies on ffmpeg (which is written in C and assembly) to analyse media files and extract frames or samples fr...阅读全文

Is Golang at all useful for writing packages for the linux ecosystem? i.e is dealing with cgo going to be alright, or is it completely the wrong tool for the job?

<p>i have recently hard switched to using arch linux full time on all my systems and not just servers, and felt like contributing and making applications or things to extend functionality within the linux ecosystem, i really am not keen to go back to c/c++ programming as go is so much more enjoyable to code in for me.</p> <p>I ha...阅读全文

Bootstrapping a system?

<p>I&#39;m looking at learning Go as my first programming language and figured this would be a good project to start out on.</p> <p>Would it be possible to write a Golang app that would take a fresh and clean vanilla install of Ubuntu for example and bring it to a full configured state?</p> <p>A rough sketch of ...阅读全文

资源 2017-02-22 21:00:10 xuanbao

Go concurrency question: the same task to many processes

<p>I&#39;m fairly new to Go and the idea behind having one common channel (e.g. a task queue) for multiple goroutines seemed quite intuitive. A dispatcher would continuously push the tasks to the queue, and the goroutines would pop the tasks from the channel as they appear.</p> <p>However, what if I wanted to communicate the ...阅读全文