Skip to content

lastingyeh/GoMemo

Repository files navigation

Golang learning memo

narcissisticNumber

  • find the rule Following example from 100 ~ 999 and print

      example: 153 = 1^3 + 5^3 + 3^3
    

fmtFormat

  • usage for fmt.Printf related.

simpleChatRoom

  • goroutine usage

  • tcp connection

  • message notification: login, rename, send message, broadcast, auto-timeout, leave...


sendFileToServer

  • simulate to upload file from client to server

byRef

  • slice: pass ref to function and print as if updated.

  • swap: pass ref to swap

  • updateDiff: difference from byValue and byRef


fib

  • use channel implement fibonacci number

overtime

  • time.After usage

basicCrawl

  • crawl for goroutine, regex and fileIO

  • /src usage: get data and write file to src folder


factorialSum

  • print 1! + 2! + ... + n!

evenAddOdd

  • use scanf to get type and get number for odd or even

guessNumber

  • scanf and switch implement classical 'guessNumber'

typefunc

  • polymorphism func type concept and variadic function demo

completeNum

  • input number

  • check range from 1 ~ number as complete (sum of factor equal number self)


palindromic

  • first letter equal last, second equal second last and so on...

kindTypeCounter

  • count the char from one string for letter, space, number and others.

largeNumberAdd

  • large numbers of manual addition simulation

closureFunc

  • check ext existed

  • accumlate


mapNote

  • rewrite map usage with structure

lockTester

  • differentiation for sync.Mutex and sync.RWMutex execute performance

  • RWMutext usage: frequency of reading is greater than writing


sortTypes

  • bubble

  • selection

  • insertion

  • quick


grpcWork

link


linkList

  • implement: push, find, insert, unshift, count, interator

library

  • model: book, student

  • action: borrow, return, checkin, checkout


reflectMemo

  • reflect int, structure, set value, ...

loadBalance

  • load balance

  • interface implement

  • easy to extend loadBalance algorithm


jsonParser

  • serialize && deserialize

ioFormat

  • charCount

  • copy file

  • readline


goroutine

  • channel, select, time.after usage

httpHead

  • get website status and set timeout

httpNotes

  • simple http handler

  • form parser handler

  • middleware for handling panic

  • template render with dynamic vars.


mysql

  • CRUD with mySQL database

ctx-timeout

  • handle http get timeout

Go Refs.

  1. Learn How To Code: Google's Go (golang) Programming Language

  2. GO语言零基础从入门到精通-实例开发

  3. 老男孩教育 Go语言第一期

  4. 【韩顺平】Go语言零基础教程

  5. golang学习

Releases

No releases published

Packages

No packages published