go語言基本配置及操作

2022-07-07 07:18:12 字數 439 閱讀 6686

a := 1

a ++ // 注意:不能寫成 ++ a 或 -- a 必須放在右邊使用

// b := a++ // 此處為錯誤的用法,不能寫在一行,要單獨作為語句使用

sodu vim /etc/profile

export goroot=/usr/local/go

export path=$path:/usr/local/go/bin

source /etc/profile

指定依賴庫的路徑及輸出檔案,vendor為依賴庫的路徑,如下;

go build-modvendor-ovim_proxy cmd/mo_proxy/main.go

go語言sprintf格式化輸出

liteide使用

通過f2在liteide裡邊檢視源**

go語言檔案基本操作

const o rdonly int syscall.o rdonly 唯讀模式開啟檔案 o wronly int syscall.o wronly 只寫模式開啟檔案 o rdwr int syscall.o rdwr 讀寫模式開啟檔案 o create int syscall.o creat 如果...

go語言 基礎系列 map基本操作

map 是雜湊表的引用,資料組 鍊錶的智慧型結合 建立 使用內建函式 mymap make map string int 通過字面量賦值 mymap map string int空map 為 map string int 刪除 使用內建函式delete delete mymap,a delete原型...

Go語言開發 基本命令及使用

go command arg 其中,command是操作命令,arg是該命令的引數。go的常用命令有 get run build fmt install test等 go get 命令主要是用來動態獲取遠端 包的,目前支援的有bitbucket github google code和launchpa...