Member-only story
Password generator with Go (Golang) Part 1
One of the most useful and easy project that we could with any programming language is a password generator, after finishing we can create passwords with any length and choose if the password should contain numbers or symbols.
Pre-requisites:
- Go installed
- Some programming experience
- Code editor of your choice
To begin our project we need to create a directory where our code will live using our following commands:
mkdir pass-generator
cd pass-generator
To initialize our go code and track our dependencies we can run the following command:
go mod init example.com/pass-generator
Instead of example.com you can use your own github url instead.
On this point we can begin coding our project, to start we can create a new file called createPassword.go. At first we declare our package and write the following lines of code
package mainconst voc string = "abcdfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
const numbers string = "0123456789"
const symbols string = "!@#$%&*+_-="
In the code above we declare 3 variable as strings, with this variables we will create our…