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

Build during Docker image creation or copy compiled binary?

<p>Usually, I have a Makefile for my go application, and run build inside docker container via RUN directive. However I am currently completing &#34;Scalable Microservices with Kubernetes&#34; course by Google, and in a lesson which describes building docker images, they say &#34;as a best practice&#34; we should build applica...阅读全文

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...阅读全文

go 介绍与安装

go Go 亦称为 Golang(译注:按照 Rob Pike 说法,语言叫做 Go,Golang 只是官方网站的网址),是由谷歌开发的一个开源的编译型的静态语言。 Golang 的主要关注点是使得高可用性和可扩展性的 Web 应用的开发变得简便容易。(译注:Go 的定位是系统编程语言,只是对 Web 开发支持较好) 既然有很多其他编程语言可以做同样的工作,如 Python,Ruby,Nodejs 等,为什么要选择 Golang 作为服务端编程语言? 为何选择 Golang 以下是我使用 Go 语言时发现的一些优点: 并发是语言的一部分(译注:并非通过标准库实现),所以编写多线程程序会是一件很容易的事。后续教程将会讨论到,并发是通过 Goroutines 和 channels 机制实现的。 ...阅读全文

博文 2019-08-13 18:32:46 Q14

Noob question (sorry)

<p>Hey guys, I&#39;m just struggling to get my head around something with go, I&#39;m only looking at the language for a day or two.</p> <p>I&#39;ve read / been told that theres no runtime, and that go programs are single executables with no dependencies. Does this mean I could run a Go program on a server which does ...阅读全文

github-webhook工具实现github自动构建

理 当本地git push origin master向Github远程仓库提交代码时,可以通过配置github自带webhook向服务器发送请求,利用github-webhook工具在服务器端接到请求后,调用自定义shell脚本来实现自动构建 github-webhook 文档 更多详情文档 https://github.com/yezihack/github-webhook 使用github-webhook 源码: https://github.com/yezihack/github-webhook 别忘记点个小星星哦. 1. 下载github-webhook工具 https://github.com/yezihack/github-webhook/releases github rel...阅读全文

博文 2020-04-24 15:33:17 百里

Using a bash script to run the correct Go binary for your OS / CPU

<p>I&#39;m writing a console program and intend on taking advantage of Go&#39;s cross compilation to create a binary for every OS and CPU architecture it supports. Ideally, I&#39;d like to distribute them all in an archive that includes a bash script that my users will run. The script should just choose the correct binary to run f...阅读全文

资源 2017-04-19 02:00:03 xuanbao

After reading about go list I made a small powershell script that will list all dependencies of a project, but also query the Github API for license information for all github imported packages

<p><a href="https://gist.github.com/elvarb/c680e52b83f069cc5e4cd2e8033999d3">https://gist.github.com/elvarb/c680e52b83f069cc5e4cd2e8033999d3</a></p> <p>Because the API has a rate limit it is better to generate an API key for this.</p> <p><a href="https://github.com/settings/tokens">h...阅读全文

资源 2017-11-08 06:00:28 blov

Golang 在 Mac、Linux、Windows 下如何交叉编译

golang-gopher.png Golang 支持交叉编译,在一个平台上生成另一个平台的可执行程序。 Golang支持的平台和版本 $ go tool dist list 其实 Golang 的交叉编译非常简单,只需要在编译前指定系统和 CPU 架构,基本不会有任何问题,编译出来讲文件拷贝到对应平台就能跑。 Mac 下编译 Linux 和 Windows 64位可执行程序 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go Linux 下编译 Mac 和 Windows 64位可执行程序 CGO_ENABLED=0 G...阅读全文

博文 2020-06-01 17:32:57 chengchaos

0基础自学linux运维-1.2-centos Go安装

根据go安装文档:https://golang.google.cn/doc/install#tarball 进行改写的 mkdir /tools cd /tools #1.卸载之前的golangyum remove golang#2.下载 https://golang.org/dl/ wget https://dl.google.com/go/go1.11.linux-amd64.tar.gz tar -C /usr/local -xzf go1.11.linux-amd64.tar.gz ll /usr/local/go/ #3.设置环境变量(方法二,这里用此方法) echo 'export PATH=$PATH:/usr/local/go/bin' >>/etc/profile tail...阅读全文

博文 2019-07-01 20:32:38 hualinux

Go语言学习-helloworld

之前学过一段时间的python,偶然的情况下接触到go语言。得知高性能,高并发,完美跨平台的优势,决定开始入手go语言学习。 首先,需要下载安装go。 https://golang.google.cn/dl/ 安装完成后,可以用命令查看是否安装成功。 打开终端,输入如下 go version // 查看版本 go env // 查看配置 接下来可以开始我们的第一个程序啦。 编写一个 hello world。需要注意文件名需要为 .go 结尾。 package main func main() { print("hello, world\n") } 运行与编译。 在终端中可直接输入 go run 进行编译运行。 在终端中输入go build 可编译为当前系统的可执行文件。 go run 文件名...阅读全文

博文 2020-05-16 21:32:50 阿巴砝特

How to run this program?

<p>Hi, <a href="/r/golang" rel="nofollow">r/golang</a>.I am reading an introductory golang book and I am stuck on a small detail.Basically the program is called &#39;dup&#39; and it is supposed to look for adjacent duplicate lines from an input source(in this case os.Stdin).It is supposed to be inspired by ...阅读全文

资源 2017-06-07 14:00:57 blov

Someone knows whats going on with the "Haunts: The Manse Macabre" project on github? Still "stuck" with no build (for several years now)?

<p>Recently I came across the fascinating story of &#34;Haunts: The Manse Macabre&#34; which is a Go written game which got successfully <a href="https://www.kickstarter.com/projects/2066438441/haunts-the-manse-macabre/" rel="nofollow">crowdfunded</a>. After some time of development, funding run out and the...阅读全文

资源 2017-03-07 20:00:08 xuanbao

Golang持续集成服务之Travis教程

为什么使用集成服务呢 我们向github提交代码时, 我们得保证我们的代码是能运行的, 我们会写测试用例, 保证我们的代码功能能正常使用.常见大神们的开源项目都一个绿色图标"build|passing 表示构建OK 如何使用Travis服务呢 打开这个网站 https://travis-ci.org/ 点击登陆, 使用github登陆.目前似也只支持github 1. 添加仓库 [图片上传失败...(image-cf0199-1587733744133)] 2. 开启集成 [图片上传失败...(image-586659-1587733744133)] 3. 项目根目录添加.travis.yml文件 cd ~/github_webhook touch .travis.yml 4. 编写.tra...阅读全文

博文 2020-04-25 01:32:56 百里江山