These are preparations of canned code for all occasions. Might come in handy sometime.
This repository is under development.
In any business, every master has a set of good tools, and coders have their own tools too.
There are two large categories of tools: the first one we use constantly, every day and they wander from one project to another, and the second type of tools we use rarely, in cases of emergency.
All these tools are well-established and tested, they are fast, efficient and safe.
I decided to build my own box of tool code so that the code would be available at all times.
You can quickly connect all the tools from this set
go get github.com/Kwynto/preserves
In your Go code, connect the blanks like this:
When you stop using this package, do not forget to get rid of unnecessary dependencies in your project
go mod tidy
This package does not require separate documentation, as it is a collection of various powerful functions and each function has a description.
If you want to increase the efficiency of your code, then you will need to take individual functions and copy them into your project.
To do this, you will need to first copy the entire repository to yourself.
git clone https://github.com/Kwynto/preserves.git
This package has two files
ordinary.go for commonly used functions and
curiosity.go for functions that are rarely needed.
You can also contribute to this repository through a pull request and this toolbox will be our shared one.
If you want to add your own function to the repository, don't forget to write a test and a benchmark.
You can create your own file, for example
<your_name>_test.go for testing (benchmarking).
Whatever the name of your file, the package must have the title
Check out the documentation
Look at the documentation in two steps.
First, in the console, run:
And then in your web browser navigate to the uri:
godoc utility may not be present in your Go build and you may need to install it
go get -v golang.org/x/tools/cmd/godoc
You can also use Go's standard functionality to view documentation in the console via
go doc GenerateId
If your IDE is good enough, then the documentation for functions and methods will be available from your code editor.
go test -v
Run tests showing code coverage:
go test -cover -v
You can view code coverage in detail in your web browser.
To do this, you need to sequentially execute two commands in the console:
go test -coverprofile="coverage.out" -v
go tool cover -html="coverage.out"
You can look at code performance tests:
go test -benchmem -bench="." curiosity.go curiosity_test.go
go test -benchmem -bench="." ordinary.go ordinary_test.go
About the author
The author of the project is Constantine Zavezeon (Kwynto).
You can contact the author by e-mail: [email protected]
The author accepts proposals for participation in open source projects,
as well as willing to accept job offers.