Tag:go

  • Who is RSA encrypting?

    Time:2022-12-6

    Who is RSA encrypting? RRSA encryption is the most commonly used asymmetric encryption method. The principle is that it is difficult to factorize a very large integer to ensure security. Usually the individual keeps the private key, and the public key is public (possibly held by multiple people at the same time). But you will […]

  • Golang non-mainstream packaging static resource solution

    Time:2022-12-6

    when it comes toGoThe program is packaged into other non-*.goresources, inGo1.16beforego-bindataThird-party open source support. existGo1.16Introduced new featuresembed, you can embed static resource permissions without relying on third parties. However, in the project, I didn’t use the above two solutions, so I developed a set of solutions by myself. If you don’t want to hear about […]

  • How does go create a new public package through module and import it for use

    Time:2022-12-6

    1. Create a Go Modules project 1. Create a folder mkdir tool && cd tool 2. Initialize the package go mod init github.com/hisheng/tool ➜ go mod init github.com/hisheng/tool go: creating new go.mod: module github.com/hisheng/tool Explanation: We send the code package to github. 3. Add business code Create a new tool.go file ➜ touch tool.go write […]

  • Embracing Open Source Guidelines

    Time:2022-12-6

    Author: Likyh Homepage:https://github.com/likyh Embracing Open Source Guidelines In recent years, open source has become more and more popular. In the eyes of many developers, “open source” is also a manifestation of geeks. Simultaneously participating in open source projects can also bring huge benefits to career development. However, some small partners failed to participate because they […]

  • Go daily library of gorilla/securecookie

    Time:2022-12-5

    Introduction A cookie is a mechanism for transferring small amounts of data between a web client (typically a browser) and a server. Generated by the server, sent to the client for storage, and each subsequent request of the client will bring the cookie. Cookies are more or less misused these days. Many companies use cookies […]

  • panic

    Time:2022-12-5

    panic Among the convincing written test questions, there was such a question: package main import “fmt” func main() { defer func() { fmt.Println(1) }() defer func() { fmt.Println(2) }() panic(3) defer func() { fmt.Println(4) }() } The answer I gave at the time was the outputpanic: 3, so what is the correct answer? The correct […]

  • Web backend development based on Gin framework (10): Detailed explanation of Gin framework-middleware (definition, use, communication and examples)

    Time:2022-12-5

    Gin-middleware: A mechanism provided by the author of the Gin framework for developers, which allows developers to customize the Hook function for request execution. The middleware function (or Hook function, hook function) is suitable for handling many repeated operations. Scenarios (such as login authentication, permission verification, data paging, time-consuming statistics, logging, etc.), if only the […]

  • Xiaomi is accused of violating the GPL agreement; iOS 16 public beta release; Go 1.19 RC1 release | Sifu Weekly

    Time:2022-12-5

    40s News Express iOS 16 Public Beta Released Musk terminates the acquisition of Twitter, Twitter’s stock price plummets The mainstream mobile phone models of domestic mobile phone manufacturers have switched to the Type-C interface Wechat test chat pictures can send up to 99 pictures Apple’s latest car design will feature face-to-face seats, no steering wheel […]

  • JWT generation and analysis

    Time:2022-12-4

    Jwt generation needs to be used: github.com/dgrijalva/jwt–go package create structure import ( “crypto/md5” “encoding/hex” “strconv” “time” “github.com/dgrijalva/jwt-go” ) type Claims struct { Flag string jwt.StandardClaims } Generate token. Generating a token requires the user’s unique identifier. Use md5 to generate a unique identifier based on the ID. You cannot use the user name and password […]

  • Go daily library of gorilla/sessions

    Time:2022-12-4

    Introduction previous article“Go Daily Library of securecookie”, we introduced cookies. At the same time, it is mentioned that cookies have two disadvantages. One is that the data should not be too large, and the other is security issues. Session is a server-side storage solution that can store a large amount of data and does not […]

  • go mod encapsulates the company’s private package and imports it for use

    Time:2022-12-4

    introduce I have written before how to encapsulate public packages (how to create public packages through modules in go, and import and use), found that many people in reality want to know about encapsulating private packages, so I will write another article on how to encapsulate private packages, and introduce it in detail. 1. Create […]

  • Use the SQL preprocessing function of Go language ORM library worm

    Time:2022-12-3

    Worm supports the precompilation of SQL statements. Using SQL statement precompilation can improve the efficiency of database access. SQL statement precompilation can be enabled in three ways in worm: global enablement, session enablement, and statement enablement. Enable global SQL precompilation package main import ( “database/sql” _ “github.com/go-sql-driver/mysql” log “github.com/haming123/wego/dlog” “github.com/haming123/wego/worm” ) func main() { dbcnn, […]