This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2.1 | |
jobs: | |
Lint: | |
docker: | |
- image: cimg/go:1.13 | |
steps: | |
- checkout | |
- run: go vet -v ./... | |
- run : go fmt ./... | |
Test: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/tls" | |
"log" | |
"os" | |
"time" | |
"github.com/joho/godotenv" | |
mail "github.com/xhit/go-simple-mail/v2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func romanToInt(s string) int { | |
valMap := map[string]int{ | |
"I": 1, | |
"V": 5, | |
"X": 10, | |
"L": 50, | |
"C": 100, | |
"D": 500, | |
"M": 1000, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# using Golang as the image | |
image: golang:latest | |
variables: | |
# Please edit to your GitLab project | |
REPO_NAME: gitlab.com/adefemi171/golang-webserver | |
# This section run before the job | |
# to be able to use go get, one needs to put | |
# the repository in the $GOPATH. So for example if your gitlab domain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// install package | |
dpkg -i gitlab-runner_amd64.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// format your code for code clean up | |
go fmt | |
// run the webserver using | |
go run main.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"time" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// creating main.go file using touch | |
// you can call this file any name | |
touch main.go | |
// creating main.go file using nano | |
nano main.go | |
// this will open up a text editor, copy and paste the code | |
// then pres ctrl + o and ctrl+x to save and exit accordingly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// update server repository | |
sudo apt-get update && sudo apt-get upgrade -y | |
// Downlod the version of your choice | |
// am using go1.15.5 | |
wget https://golang.org/dl/go1.15.5.linux-amd64.tar.gz | |
// Unzip Golang using tar | |
tar xvf go1.15.5.linux-amd64.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// update the server repository | |
sudo apt-get update && sudo apt-get upgrade -y | |
// install docker | |
sudo apt-get install -y docker.io | |
// Enable and start docker | |
sudo systemctl enable docker | |
sudo systemctl start docker |
NewerOlder