Skip to content

Instantly share code, notes, and snippets.

View dumindu's full-sized avatar
🌱
One step at a time...

Dumindu Madunuwan dumindu

🌱
One step at a time...
View GitHub Profile
package main
import (
"fmt"
"sync"
)
func main() {
wg := sync.WaitGroup{} // 1. Create a WaitGroup
wg.Add(1) // 2. Add 1 to WaitGroup counter
package main
import (
"fmt"
"sync"
)
var wg = sync.WaitGroup{} // 1. Create a WaitGroup
func main() {
package main
import (
"fmt"
"time"
)
func main() {
go sayHello()
package main
import "fmt"
func main() {
go sayHello()
}
func sayHello() {
fmt.Println("Hello world!")
package main
import "fmt"
func main() {
sayHello()
}
func sayHello() {
fmt.Println("Hello world!")
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: helloworld.proto
package helloworld
import (
context "context"
fmt "fmt"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: helloworld.proto
package helloworld
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
Name Command State Ports
--------------------------------------------------------------
myapp_app_1 /myapp/app Up 0.0.0.0:8080->8080/tcp
myapp_db_1 /scripts/run.sh Up 0.0.0.0:3306->3306/tcp
type BookForm struct {
// ...
Author string `json:"author" form:"required,alpha_space,max=255"`
PublishedDate string `json:"published_date" form:"required,date"`
}
import "regexp"
const (
alphaSpaceRegexString string = "^[a-zA-Z ]+$"
dateRegexString string = "^(((19|20)([2468][048]|[13579][26]|0[48])|2000)[/-]02[/-]29|((19|20)[0-9]{2}[/-](0[469]|11)[/-](0[1-9]|[12][0-9]|30)|(19|20)[0-9]{2}[/-](0[13578]|1[02])[/-](0[1-9]|[12][0-9]|3[01])|(19|20)[0-9]{2}[/-]02[/-](0[1-9]|1[0-9]|2[0-8])))$"
)
func New() *validator.Validate {
// ...