当前位置: 首页 > news >正文

从0开始学go 第一天

今天是开始学go的第x天,前些日子看了看语言,今天找一个web开发来跟着学,记录一下遇到的问题,方便以后复习查阅。

视频看的是https://www.bilibili.com/video/BV1gJ411p7xC?p=3&vd_source=ab5bdbd04f4142027c66d604d5285204

 视频中用的是goland,我用的vs

如何在vs中建一个项目:

https://blog.csdn.net/sepnineth/article/details/125153354

这也是为了解决一个报错:

go.mod file not found in current directory or any parent directory.'go get' is no longer supported outside a module.To build and install a command, use 'go install' with a version,like 'go install example.com/cmd@latest'For more information, see https://golang.org/doc/go-get-install-deprecationor run 'go help get' or 'go help install'.

因为下载gin的时候会报错,就是这个命令:go get -u github.com/gin-gonic/gin

初次尝试go写一个网页还是挺有意思的

package mainimport ("fmt""net/http"
)func sayHello(w http.ResponseWriter, r *http.Request) {_, _ = fmt.Fprintln(w, "Hello jzy")
}func main() {http.HandleFunc("/hello", sayHello)err := http.ListenAndServe(":9090", nil)if err != nil {fmt.Printf("http server failed, err:%v\n", err)return}
}

http://www.lryc.cn/news/139876.html

相关文章:

  • Spring Cloud Nacos详解
  • 2023谷歌开发者大会直播大纲「初稿」
  • react import 引用失效 node_modules/@types/react/index.d.ts not a module.ts
  • Unity中的Unistorm3.0天气系统笔记
  • VMVareC++开发环境快速配置
  • 数据库为什么使用B+树而不是B树做索引
  • java必知必会--面向对象及相关基础知识
  • 【推荐】Spring与Mybatis集成
  • 中科驭数受邀在招商银行金融科技论坛作异构计算主题分享 解码金融科技先进算力构建之路
  • Maven打包方式pom和jar和war的区别
  • 【51单片机】EEPROM-IIC实验(按键控制数码管)
  • 【java】【springboot】【idea】springboot项目pom.xml 灰色下划线
  • [JavaWeb]【十四】web后端开发-MAVEN高级
  • 浏览器跨域
  • ffmpeg windows环境MinGW+msys2编译so库
  • python VTK PyQt5 VTK环境搭建 创建 渲染窗口及三维模型,包含 三维模型交互;
  • 学习总结(二) node.js服务器如何使用net模块向硬件发送命令与接收数据?
  • rust工程
  • Java并发工具类
  • 晨控CK-GW208与三菱L系列PLC以TCP通讯手册
  • c++11 标准模板(STL)(std::basic_istringstream)(五)
  • 【案例教程】高分论文密码:大尺度空间模拟预测与数字制图
  • uniapp 自定义手机顶部状态栏(适配状态栏高度)
  • 【LeetCode】1448.统计二叉树中好节点的数目
  • C语言基础之——数组
  • c# 插入排序
  • action和mutation之间的利用 代码解释
  • WPF基础入门-Class4-WPF绑定
  • 【广州华锐互动】VR高校虚拟实验教学平台提供丰富的资源支持,提高教学效果
  • pytorch学习(7)——神经网络优化器torch.optim