Coder Social home page Coder Social logo

golang-examples's Introduction

golang-examples

这个项目放在 github 上,所以项目的路径是 %GOPATH%/src/wyrover/golang-examples

  • example01 基本 golang 例子

第一个例子写一个命令行程序

cd %GOPATH%/src/wyrover/golang-examples/example01
dep init

添加一个包

dep ensure -v -add github.com/fatih/color

dep 更新是相当的慢,还的挂代理,shadowsocks 的 socket5 转 http 代理,再设置环境变量 转 http 带来用 cow 实现, http 代理地址 http://127.0.0.1:7777, 在 cow 配置文件里设置

设置环境变量

set http_proxy=http://127.0.0.1:7777
set https_proxy=http://127.0.0.1:7777

设置 git 代理

git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'

dep 安装相关的包,还的有 main.go 文件存在

package main

import (
    "fmt"

    "github.com/fatih/color"
)

func main() {
    fmt.Println("Hello World!")

    color.Cyan("Prints text in cyan.")
}
go run main.go

测试 dep ensure -v,删除 vendror 目录,再次执行 dep ensure -v 更新包

golang-examples's People

Contributors

wyrover avatar

Watchers

 avatar

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.