09/03/2019 22:22 GMT

I could stand there and watch the wave all day.

01/03/2019 14:21 GMT

This is the script I used to manage Go’s SDK, it’s built on top of the official Google go way. I run it inside Windows Subsystem for Linux (WSL), it’s manages both WSL and Windows itself in one call inside WSL.

./gvm

#!/bin/bash
go get golang.org/dl/$1
GOOS=windows go build -o /d/go/bin/$1.exe golang.org/dl/$1
$1 download
$1 version
$1.exe download
$1.exe version

Usage example ./gvm go1.9

I also written an uninstall counterpart.

./ugvm

#!/bin/bash
cd $( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )
rm -rf sdk/$1
rm go/bin/$1
rm -rf /c/Users/ChristopherJohn/sdk/$1
rm /d/go/bin/$1.exe

Usage example ./ugvm go1.9

Note: you may to need to adjust the code to get it to work on your system. It’s can also work on pure Unix style systems, just get rid of anything Windows related .exe in the script

I could of used Moovweb’s GVM, but the complexity of the system scares me, honestly I value simple yet brilliant things much better. 🙂

17/02/2019 14:14 GMT

That very easy, all I used was constant variable in it’s own package, just reference the constant variable inside the router or sprintf if you’re doing reverse URL. Here an example of the constant variable I used for URL routing.

package frontUrl

const (
	BlogIndex      = "/"
	BlogAjaxIndex  = "/blogajax"
	BlogIndexPage  = "/p/:page"
	BlogIndexPageF = "/p/%d"
	BlogEntry      = "/blogentry/:idSlug"
	BlogEntryF     = "/blogentry/%d-%s"
	BlogFeed       = "/feed.json"

	FontsFiles       = "/fonts/*filepath"
	JavascriptsFiles = "/javascripts/*filepath"
	StylesheetFiles  = "/stylesheets/*filepath"
	ImagesFiles      = "/images/*filepath"
	FaviconFiles     = "/favicon/*filepath"
	DynImg           = "/dyn-img/:name"
	DynImgF          = "/dyn-img/%s"
	Style            = "/generated.css"
)

The reason I prefer to conform to good practice is because I want to be able to understand the source code that I have written six month ago, if I didn’t conform to good practice in programming than the source code I have written will be difficult to understand in six month time not only for me but other programmers as well, that the main point of conforming to good practice.

Happy New Year to Everyone 🥳

| |

Privacy Policy