go-jwt jwt go

Go - Formatting time

func main () { t := time . Now () fmt . Println ( t . Format ( "3:04PM" )) fmt . Println ( t . Format ( "Jan 02, 2006" )) } When you run this you shou ......
Formatting time Go

Go - Measuring Lapsed Time

Problem: You want to measure the lapsed time and make sure that it is accurate. Solution: Use the monotonic clock in the Time struct to find the lapse ......
Measuring Lapsed Time Go

go语言ent教程:使用zerolog定制ent日志

背景:ent开始debug模式后,可以输出日志,但是我们想为ent接入zerolog,该怎么做呢? 一、引入zerolog go get -u github.com/rs/zerolog 二、自定义zerolog配置 customLog := func(args ...any) { str := f ......
ent zerolog 语言 教程 日志

go语言ent教程:开启debug调试模式

背景:ent模式是没有开启debug模式的 开启ent的调试模式有2种方法: 一、通过配置选项开启 client, err := ent.Open("mysql", "root:dev@123456@tcp(localhost:3306)/test?parseTime=True", ent.Debu ......
语言 模式 教程 debug ent

Go - Representing Duration

Problem: You want to specify a duration of time. Solution: Use the Duration type to represent a span of time. The main representation for a span of ti ......
Representing Duration Go

Go - Representing Time Zones

Problem: You want to include the time zone information in a Time struct. Solution: The Time struct includes a Location , which is the representation o ......
Representing Zones Time Go

vue-router.esm.js:2065 Uncaught (in promise) Error: Redirected when going from "/login?redirect=%2Fhome" to "/home" via a navigation guard.

原因: vue-router路由版本更新产生的问题,导致路由跳转失败抛出该错误; 真正的原因是由于返回了一个Promise对象, 正常的跳转由then方法执行 当正常的路由跳转, 被"路由导航守卫"拦截并重新指定路由时, 由于 this.$router.push() 返回的是Promise对象, 此 ......

kubelet.go 2466 Error getting node not found

kubeadm初始化kubernetes集群报错,kubelet服务提示:kubelet.go:2466] "Error getting node" err="node \"k8s3-master\" not found处理记录。 0. ENV kubernetes 1.22.x/1.23.x/1. ......
kubelet getting Error found 2466

Go - Decoding Data with a Customized Binary Format to Structs

Problem: You want to decode the customized binary format back to structs. Solution: Use the encoding/binary package to take data from the binary forma ......
Customized Decoding Structs Binary Format

Go - Encoding Data to a Customized Binary Format

Problem: You want to encode struct data to a customized binary format. Solution: Design your customized format and use the encoding/binary package to ......
Customized Encoding Binary Format Data

Go - Decoding gob Format Data to Structs

Problem: You want to decode gob format data back to structs. Solution: Use the encoding/gob package to decode the gob format data back to structs. fun ......
Decoding Structs Format Data gob

Go - Encoding Data to gob Format Data

Problem: You want to encode structs into binary gob format. Solution: Use the encoding/gob package to encode the structs into bytes that can be stored ......
Data Encoding Format gob Go

2023-10-04:用go语言,现有一棵无向、无根的树,树中有 n 个节点,按从 0 到 n - 1 编号 给你一个整数 n 和一个长度为 n - 1 的二维整数数组 edges , 其中 edge

2023-10-04:用go语言,现有一棵无向、无根的树,树中有 n 个节点,按从 0 到 n - 1 编号 给你一个整数 n 和一个长度为 n - 1 的二维整数数组 edges , 其中 edges[i] = [ai, bi] 表示树中节点 ai 和 bi 之间存在一条边。 每个节点都关联一个价 ......
整数 数组 节点 长度 语言

go定时任务

目录go定时任务TimeNewTimerNewTickercron文档 go定时任务 Time NewTimer package main import ( "fmt" "time" ) func cronTimer() { /** timer定时器 实现一些定时操作 本质通过chan阻塞实现 且只 ......
任务

Go语言中泛型的一个用法

type OperationWithData[T any] func() (T, error) type Operation func() error func (o Operation) withEmptyData() OperationWithData[struct{}] { return fu ......
语言

Go - Creating JSON Data Streams from Structs

Problem: You want to create streaming JSON data from structs. Solution: Create an encoder using NewEncoder in the encoding/json package, passing it an ......
Creating Streams Structs Data JSON

Go - Creating JSON Data Byte Arrays from Structs

Problem: You want to create JSON data from a struct. Solution: Create the structs then use the json.Marshal or json.MarshalIndent to marshal the data ......
Creating Structs Arrays Byte Data

C PHP Go.md

C 语言 1.visual Studio lnstaller 安装 去官网下载后点击exe文件,在弹出的窗口中点击继续后,选择c++桌面开发并点击安装。 注册账号 登录vsl的时候需要登录账号,所以需要试用邮箱创建一个账号。 新建项目 点击新建项目后,再点击控制台应用并下一步,输入项目名称、路径、解 ......
PHP Go md

go-ethereum mint nft用户支付实现

代码: package main // 签名用的公钥私钥也是采用的owner的公钥私钥 import ( "context" "fmt" "math/big" "user-pay/triplec" "github.com/ethereum/go-ethereum/common" "github.co ......
go-ethereum ethereum 用户 mint nft

go-ethereum设置signer

设置代码: package main // 签名用的公钥私钥也是采用的owner的公钥私钥 import ( "fmt" "set_signer/triplec" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-eth ......
go-ethereum ethereum signer go

用go封装一下二级认证功能

本篇为[用go设计开发一个自己的轻量级登录库/框架吧 - 秋玻 - 博客园 (cnblogs.com)]的二级认证业务篇,会讲讲二级认证业务的实现,给库/框架增加新的功能。 源码:https://github.com/weloe/token-go ......
功能

5.go语言函数提纲

1 本篇前瞻 前端时间的繁忙,未曾更新go语言系列。由于函数非常重要,为此将本篇往前提一提,另外补充一些有关go新版本前面遗漏的部分。 需要恭喜你的事情是本篇学完,go语言中基础部分已经学完一半,这意味着你可以使用go语言去解决大部分的Leetcode的题,为此后面的1篇,将带领大家去巩固go语言的 ......
提纲 函数 语言 go

Go结构体深度探索:从基础到应用

在Go语言中,结构体是核心的数据组织工具,提供了灵活的手段来处理复杂数据。本文深入探讨了结构体的定义、类型、字面量表示和使用方法,旨在为读者呈现Go结构体的全面视角。通过结构体,开发者可以实现更加模块化、高效的代码设计。这篇文章旨在为您提供关于结构体的深入理解,助您更好地利用Go语言的强大功能。 关 ......
深度 结构 基础

Go每日一库之155:go-spew(输出 Go 数据结构)

对于应用的调试,我们经常会使用 fmt.Println来输出关键变量的数据。或者使用 log 库,将数据以 log 的形式输出。对于基础数据类型,上面两种方法都可以比较方便地满足需求。对于一些结构体类型数据,通常我们可以先将其序列化后再输出。 如果结构体中包含不可序列化的字段,比如 func 类型, ......
数据结构 go-spew 结构 数据 spew

Go每日一库之160:gvm(Go版本管理)

[**gvm **](https://github.com/moovweb/gvm)用于go版本的管理,主要的功能为go版本的查看,下载安装和切换。 ## 安装 ```bash $bash < <(curl -s -S -L https://raw.githubusercontent.com/moo ......
版本 160 gvm

Go每日一库之152:gomacro(终端运行go代码)

`[gomacro](https://github.com/cosmos72/gomacro)` 是一个近乎完整的 Go 解释器,用纯 Go 实现,它同时提供交互式 `REPL` 和脚本模式,并且在运行时不需要 Go 工具链(除了一些非常特殊的场景:在运行时导入第三方包)。它在 Go 标准库之外有两 ......
终端 gomacro 代码 152

Go每日一库之166:go-version(语义化版本)

今天给大家推荐的是一个版本比较工具。该工具基于语义化标准的版本号进行比较、约束以及校验。以下是go-version的基本情况: **安装** 通过go get进行安装: ``` go get github.com/hashicorp/go-version ``` **解析和比较版本号** ``` v ......
语义 go-version version 版本 166

Go每日一库之165:go-callvis(可视化调用链)

本文介绍一款工具 go-callvis,它能够将 Go 代码的调用关系可视化出来,并提供了可交互式的 web 服务。 ## go-callvis 使用 ##### 依赖 - Go 1.17+ - Graphviz (可选,当工具指定了 `-graphviz` 时需要) ##### 工具安装 ``` ......
go-callvis callvis 165 go

Go每日一库之149:PDF处理相关库

**PDF处理场景:** - pdf渲染 - pdf校验 - pdf加水印 - pdf获取页数 - pdf合并 - pdf拆分 - 修复受损pdf - pdf转png - 识别pdf中的字体 - pdf解密 ... ### 一、HTML页面渲染PDF 根据html页面渲染pdf,我使用过以下两种方案 ......
149 PDF

Go每日一库之151:aurora(终端输出上色)

## 背景介绍 今天跟大家推荐一款可以给终端输出上色的工具--[aurora](https://github.com/logrusorgru/aurora)。 ![](https://img-blog.csdnimg.cn/20200405145155570.png) ## 极速上手 ### 准备工 ......
终端 aurora 151