PROGRAMMING


  Different ways of handling concurrent job in GoLang

GoLang provides very good support of concurrency and the way to make some code to run concurrent is pretty simple and straightforward. Adding a simple go before a normal function call will make the function call asynchronous.In real cases normally people would concurrently run some jobs to improve the speed and efficiency. One important part of running jobs concurrently is about aggregating results so that the consequent function call would be able to proceed. There are multiple ways handling this scenarios.One of them is using WaitGroup from sync package. The pattern is like:var wg sync.WaitG...

2,619 0       COMPARISON WAITGROUP WORKER POOL CONCURRENT


  Run code with multiple files in the same main package in GoLang

To run a GoLang program, there needs to be a main() function defined. In some cases when developing some demo program which has multiple files and just wanna put them in the same main package and this folder is not in GOPATH, how to run the program?Let's say we have following folder structure where the main() function is defined in main.go.If you just run below command, it would fail to start to run the program and gives some error if some struct is defined in other files and being used.PS D:\Project\Go\sourcecode_updater\v2> go run main.go# command-line-arguments.\main.go:35:11: undefined:...

20,765 0       GOLANG EXECUTABLE MAIN PACKAGE MULTIPLE FILE


  Understanding GoLang interface

If goroutine and channel are considered as the foundation for GoLang concurrency, interface would be the key for data types in GoLang. In practical Go programming, almost all data types are built/used around interfaces, interface is the core of GoLang data structures.Go is not a typical OOP language, it has no class and inheritance concept syntactically. But it doesn't mean that there cannot be polymorphism in GoLang. Because of interface, it achieves the same polymorphism effect as in C++, though syntactically different.Although Go doesn't have concept of class, it allows different data types...

7,506 1       INTERFACE GOLANG


  Error handling in GoLang

Error handling is one of the must talked topics for any programming language. The program would be more reliable and stable if errors are handled properly and timely. Each programming language has its own way to handle error, this applies to GoLang as well. This post will discuss more about GoLang's error handling mechanism.Error handlingBefore talking more about GoLang's error handling, we can see how different programming languages are handling errors.C's error checkThe most direct way of checking error is using error code, and this is also how error is being checked traditionally. In proced...

3,414 0       GOLANG ERROR HANDLING FLUENT INTERFACE


  Go 1.16 is released

Note: The post is authorized by original author to republish on our site. Original author is Stefanie Lai who is currently a Spotify engineer and lives in Stockholm, original post is published here.Last week, Go1.16 was released, bringing relatively more changes than version 1.15, which was influenced by the epidemic.The update is in many aspects, including compilation, deployment, standard library, etc. In the official Go document, all changes are classified based on Tools, Runtime, Complier, etc.It is undoubtedly good to dig into all the changes, but sometimes we understa...

950 0       GOLANG GO1.16 NEW FEATURES


  Top 10 reasons to use a low-code platform

Generally, as the best coding platforms, low code includes low code app development, process development solutions and software development tools. IT users utilize low code solutions as a source of the required building blocks for the building of workflows and applications. The building blocks make it easier to assemble apps and workflows without requiring hand-coding. The growth of low-code platforms therefore levels business grounds by reducing the time spent in coding among other benefits. Organizations now have access to more tools and technologies. For this reason, IT teams can handl...

975 0       LOW CODE PROGRAMMING


  Is Java Set ordered or not?

“Is Java Set ordered or not? ” is the most popular question asked when you interview for a Java Developer position. Many fail to answer it, and I have to admit I was one of the many.I have known the answer is “Yes and No” for a long time.No. HashSet is not ordered.Yes.TreeSet is ordered.If the interviewer continues with some follow up questions, I’m not confident that I know the answer then.Why is TreeSet ordered?Are there any other ordered Set implementations?As a growth-minded developer that always wants to improve, it is necessary to absorb some ...

3,862 0       JAVA HASHSET SORTEDSET ORDER


  How to check when an API is introduced in GoLang

Normally people would not pay much attention to which GoLang version is being used as lots of functions are backward compatible. However there are cases where GoLang version does matter as some functions may not be supported by old version of GoLang. For example, strings.Builder is introduced in Go 1.10, but below code would fail to be compiled on Go 1.10.package mainimport ( "fmt" "strings")func main() { var b strings.Builder b.WriteString("polarisxu") fmt.Println(b.Cap())}The compilation error is:$ go versiongo version go1.10.8 darwin/amd64$ go run main.go# command-line-arguments./main.g...

2,019 0       GO TOOL API VERSION GOLANG