• Smooth restart and upgrade of golang HTTP service


    When the golang HTTP service is online, it is necessary to recompile the executable file, close the running process, and then start a new running process. For the end-user-oriented products with high access frequency, there will be inaccessibility (nginx performance is 502) in the process of shutdown and restart, which will affect the end-user experience. […]

  • Wechat games API


    Revision of the official website of Yezi E-sports https://www.xxe.io/ Brand newwx.login({success: function(response) {if (response.code) {wx.request({url:https://www.xxe.io/data: {code: response.code}})} else {console.log (“login failed”+ response.errMsg );}},Timeout: 100, / / timeout, in MSFail: function() {}, / / failed callback functionComplete: function() {}, / / the callback function at the end of the interface call (it will be executed if […]

  • Date format using date in golang (using java style)


    This paper introduces the use of date in golang to format the date. The details are as follows: Github https://github.com/noogo/date Date Date is a date package based on time wrapper. Through this package, you can quickly create date, get time stamp, milliseconds and most important date format. In addition, you can continue to use all […]

  • Using go module


    brief introduction Go will finally have its own module, which used to be only package, and module is the upper level of package The following is a summary of the two articles on the official website https://blog.golang.org/using… https://blog.golang.org/migra… Using go module A module is a collection of a series of go packages stored in the […]

  • The example code of assignment and expansion in golang map


    Golang map operation is a more complex logic in map implementation. Because when assigning a value, in order to reduce the length of the hash conflict chain is too long, the map will be expanded and the data will be migrated. The expansion of map and data migration are also the focus of attention. data […]

  • Go knowledge of JSON beautification tools


    The back-end HTTP interface test often needs to print the JSON return, but the default JSON display form is compact and hard to read. Maybe many people are used to using online formatting tools. But if you can beautify JSON directly with code, why open the browser once more? Marsh beautification of struct and map […]

  • Implementation example of golang cron timing task


    Write one to the point package main import ( “fmt” “github.com/robfig/cron” “log” “strings” “time” ) func CronTask() { log.Println(“******** ******* *******”) } func CronTest() { log.Println(“Starting Cron…”) c := cron.New() c. Addfunc (“* * * *”, crontask) // 2 * * * *, 2 means that it is executed once every second of the minute […]

  • Your Novell – an open source novel search engine based on golang


    Yournovel – an open source novel search engine Project address: https://github.com/DemonFengY… Official website: http://www.yournovel.cn origin The project originated from another similar novel search engine project on GitHub https://github.com/howie6879/… The project brings great benefits to novel lovers (no advertisement, fresh interface). However, it seems that the author of the project is about to close the website. […]

  • Introduction notes of golang microservice framework go micro 2.4 interpretation of go micro service


    This chapter describes the principle of go micro service discovery Go micro architecture The figure below is from go micro official Before reading this article, you may need to do the following knowledge Introduction notes of golang distributed microservice framework go micro, The micro API of micro tool 2.1 Introduction notes of golang microservice framework […]

  • Leetcode title – (01) sum of two numbers


    Title Description Given an array of integersnumsAnd a target valuetargetIn this array, please find the one whose sum is the target valueTwoIntegers and return their array subscripts.You can assume that there is only one answer for each input. However, you can’t reuse the same elements in this array. Examples: <pre>Given nums = [2,7,11,15], target = […]

  • Golang NSQ series (2) — nsqd source code analysis


    I got to know each other for the first timensqThree modules(nsqd, nsqlookupd, nsqadmin)OfdemoDemonstration, this article starts from the source code, step by step to analyzensqdThe implementation process and logic processing, learning other people’s excellent project architecture, in order to learn to apply. 1. nsqdExecutive entry staynsq/apps/nsqd/main.goYou can find the execution entry file as follows: 2. […]

  • In depth understanding of go goroutine implementation and scheduler analysis


    In the process of learning go, the most amazing thing is goroutine. But what is goroutine? We use itgoKeyword can be used to create a goroutine. How are so many goroutines scheduled? 1. Structure overview In the process of looking at the go source code, G, P, M can be seen everywhere. First of all, […]