zoukankan      html  css  js  c++  java
  • go语言

    1.安装完之后,会自动添加一个GOROOT环境变量,指向的就是go的安装目录,这样就能在各个路径执行go命令

    2.安装完之后需要自己添加GOPATH环境变量,指向自己的项目目录,这样就能执行这个位置的代码,还有下载的包也会默认导入到这个目录下。

    3.go get github.....从github上拉去包 如:go get -v github.com/spf13/cobra/cobra

    4.设置环境变量 set GOPATH=E:/go_test查看当前环境变量:echo %GOPATH%

    5.sublime 调试 go, 把编译系统选项设置为go, ctrl+shift+p 安装golang,Preferences->按键绑定-用户,加入{ "keys": ["f5"], "command": "build", "args": {"variant": "Run"} }(可参照按键绑定默认)然后就可以f5调试了。

     6.git bash模拟post请求,curl -d "a=1" "http://localhost:8080",不加-d是get请求

     7.go语言部署到不同服务器方式:

      64位系统:

      linux
      GOOS=linux GOARCH=amd64 go build -ldflags "-w -s" -o web;

      windows
      GOOS=windows GOARCH=amd64 go build -ldflags "-w -s" -o web;

      mac

      GOOS=darwin GOARCH=amd64 go build -ldflags "-w -s" -o web


    8.如果报权限不够,那么先对文件执行chmod -R 777:比如:
    chmod -R 777 /home/test/web


    vscode 先装一个vscode的go插件然后在gopath/bin内安装一堆github的东西配置go:

    {
    "git.path": "E:\installedsoftware\Git\cmd\git.exe",
    // "editor.parameterHints": false,
    // "editor.quickSuggestions": false,
    "fileheader.Author": "ZhangShuai",
    "fileheader.LastModifiedBy": "Janson",
    "fileheader.tpl": "/* * @Author: {author} * @Date: {createTime} * @Last Modified by: {lastModifiedBy} * @Last Modified time: {updateTime} */ ",
    "workbench.colorCustomizations": {
    "editor.selectionBackground": "#6622aa"
    },
    "editor.wordWrap": "on",
    "editor.minimap.enabled": false,
    "window.zoomLevel": 3,
    "workbench.colorTheme": "Material Theme",
    "git.ignoreMissingGitWarning": true,
    "sync.gist": "5fcee84fc617c99f20462cd915729978",
    "sync.host": "",
    "sync.pathPrefix": "",
    "sync.quietSync": false,
    "sync.askGistName": false,
    "sync.removeExtensions": true,
    "sync.syncExtensions": true,
    "sync.autoDownload": false,
    "sync.autoUpload": false,
    "sync.lastUpload": "2018-05-08T11:50:08.998Z",
    "sync.lastDownload": "",
    "sync.forceDownload": false,
    "git.autofetch": true,
    "emmet.triggerExpansionOnTab": true,
    "go.gopath": "D:\workspace\learn\gotest",
    "go.goroot": "C:\Go",
    "go.buildOnSave": true,
    "go.lintOnSave": true,
    "go.vetOnSave": true,
    "go.buildFlags": [],
    "go.lintFlags": [],
    "go.vetFlags": [],
    "go.coverOnSave": false,
    "go.useCodeSnippetsOnFunctionSuggest": false,
    }
  • 相关阅读:
    国家行政区划地区编码表
    Java循环中标签的作用(转)
    通过ribbon 根据服务名获取所有服务实例的IP和端口列表
    rabbitmq重装依赖的erlang 要注意
    Rabbitmq关于集群节点功能的读书笔记
    CentOS7统计某个进程当前的线程数
    理解同步、异步、阻塞、非阻塞(传送门)
    代理模式和装饰模式区别
    【转载】Asp.Net生成图片验证码工具类
    【转载】使用宝塔Linux面板屏蔽某些IP访问你的服务器
  • 原文地址:https://www.cnblogs.com/feixiangsnail15-12-28/p/9143150.html
Copyright © 2011-2022 走看看