This file contains hidden or 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 ( | |
| "fmt" | |
| "math/big" | |
| "runtime" | |
| "sync" | |
| "time" | |
| ) |
This file contains hidden or 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 ReplaceStringInSlice(slice []string, replace string, with string) []string { | |
| for i, v := range slice { | |
| if v == replace { | |
| slice = append(slice[:i], slice[i+1:]...) | |
| slice = append(slice, with) | |
| return slice | |
| } | |
| } | |
| return slice | |
| } |
This file contains hidden or 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 util | |
| import ( | |
| "net/http" | |
| "github.com/casbin/casbin" | |
| "github.com/qiangxue/golang-restful-starter-kit/app" | |
| "github.com/go-ozzo/ozzo-routing" | |
| ) | |
| // Authorizer is a middleware that controls the access to the HTTP service, it is based |
This file contains hidden or 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
| #!/bin/bash | |
| trap '[ "$?" -eq 0 ] || read -p "Looks like something went wrong... Press any key to continue..."' EXIT | |
| VM=default | |
| DOCKER_MACHINE=./docker-machine.exe | |
| if [ ! -z "$VBOX_MSI_INSTALL_PATH" ]; then | |
| VBOXMANAGE="${VBOX_MSI_INSTALL_PATH}VBoxManage.exe" |