加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

golang学习笔记

发布时间:2020-12-16 19:11:44 所属栏目:大数据 来源:网络整理
导读:安装 下载 http://golangtc.com/download 安装 https://golang.org/doc/install?download=go1.8.3.darwin-amd64.pkg //osx 环境变量 $vi ~/.zshrc export GOROOT=/Users/lucifer/Documents/go export GOBIN=$GOROOT/bin export PATH=$PATH:$GOBIN export GOP

安装

下载 http://golangtc.com/download
安装https://golang.org/doc/install?download=go1.8.3.darwin-amd64.pkg //osx
环境变量
$vi ~/.zshrc
export GOROOT=/Users/lucifer/Documents/go
export GOBIN=$GOROOT/bin
export PATH=$PATH:$GOBIN
export GOPATH=/var/www
export PATH=$PATH:$GOPATH/bin
$source .zshrc
查看版本 $go version
查看位置 $which go
部署
监控
框架
ginhttp://shanshanpt.github.io/2016/05/03/go-gin.html
IDE
Gogland https://www.jetbrains.com/go/

一般结构

//当前程序的包名
package main //一个可执行程序有且仅有一个main包
//导入其他的包
import . "fmt"
//常量定义
const PI = 3.14
//全局变量
var name = "hello"
//一般类型
type newType int
//结构声明
type newStruct struct {}
//接口声明
type newInterface interface {}
//main 函数只能在main包,main包需要main函数作为入口,不能有返回值
func main() {
fmt.Println("hello world!")
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读