How to fix no network issue in lintmint

Today, when I opened my laptop, I found that I could not open google. It’s so weird! And I found no networking connection that time, here is how I fix this issue to keep my work going on. Env: OS: LinMint 21.1 Cinnamon VM: virtual machine V17 Network mode: NAT First of all, I checked whether the network enabled or not. sudo cat /var/lib/NetworkManager/NetworkManager.state And the result is: [main] NetworkingEnabled=false WirelessEnabled=true WWANEnabled=true The NetworkingEnabled is false, this is why my lintmint has no network....

December 5, 2023 · 1 min · wuqiangroy

How to test the APIs of your Go-Gin service?

As the pre-post said, Gin is a famouse web framework writen by Go. I love it and always use it. When I wrote a web server using Go-Gin, how do I test the APIs? This may confused me, only use a command-line tool to verify them? It’s seems ridiculous and non-product. We need to have a full-check for the APIs and it’s better to make it automatic, then we need to integrate it in the CI-CD pipline, make sure that it will run automaticly after we commit codes....

January 3, 2023 · 5 min · wuqiangroy

How to set a Go project as a Go module?

When we create an aswsome project written by Go, we always want to provide it for others. Some good projects like gorilla websocket, gorm and gin, we can easily to run go get github.com/xxx to get the Go module and then use it in our projects. So, how can we build our own Go project as a Go module? Github In the platform of Github, you may want to build your projects for all the users so they can use your project directly....

January 1, 2023 · 3 min · wuqiangroy

Integrate websocket to gin

Introduction Gin is a famous web framework written in Go, we can easy to build our web server by following codes: 1 2 3 4 5 6 7 8 9 10 11 12 package main import "github.com/gin-gonic/gin" func main() { r := gin.Default() r.GET("/hello-world", func(c *gin.Context) { c.JSON(200, gin.H{ "message": "hello, world", }) }) r.Run() // listen and serve on 0.0.0.0:8080 } Saving these 11 lines codes as a hello.go file, then run go run hello....

December 16, 2022 · 5 min · wuqiangroy

使用 Hugo 搭建自己的博客

前些年的时候,我在腾讯云上面购买了一个云服务器,一个域名,然后自己用 python 写了一个博客后端。 使用 Nginx 作为正向代理,就这样搭建了我第一个博客。 这个博客内容还挺多,评论、文章、用户系统、富文本编辑框等等,一一俱全。 后来自己对博客的维护比较少,出现了一些 bug 我也难得修复了,等到服务器到期,我就难得续费了。 后来在网上看到很多博客都非常精美,有的用 wordpress 搭建的,有的用 hugo 搭建的,结合我自己的场景,我决定使用 hugo + github 来创建自己的博客。 安装 golang hugo 使用 golang 写的,要使用 hugo,需要先安装 golang。安装教程 安装 hugo macOS 下 hugo 的安装方法: brew instal hugo 其他平台参考官方文档:hugo installation 创建一个博客 使用 hugo 命令:hugo new site blog 在当前地址创建一个 blog 文件。 里面的布局如下: - archetypes - content - data - layout - public - resource - static - themes config.toml 其中,config.toml 是我们的配置文件,我们主要的修改都在这个配置文件里面。 使用主题 原生的 hugo 博客并不好看,好在官方及各路大神提供了不少主题,我们直接可以使用,我很喜欢 even 主题,所以我使用 even 来说明。...

November 28, 2022 · 2 min · wuqiangroy