From 87c814061859750b0bf2576d6ef3be89c2a1e68b Mon Sep 17 00:00:00 2001 From: Martin Lindhe Date: Thu, 12 Jan 2017 00:45:14 +0100 Subject: [PATCH] README: enable syntax highlighting (github-markdown) for go snippets --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cd3df58..823bcc5 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ To see a real example of how to use `genny` with `go generate`, look in the [exa Define your generic types using the special `generic.Type` placeholder type: -``` +```go type KeyType generic.Type type ValueType generic.Type ``` @@ -92,7 +92,7 @@ type ValueType generic.Type Then write the generic code referencing the types as your normally would: -``` +```go func SetValueTypeForKeyType(key KeyType, value ValueType) { /* ... */ } ``` @@ -114,7 +114,7 @@ The output will be the complete Go source file with the generic types replaced w Given [this generic Go code](https://github.com/cheekybits/genny/tree/master/examples/queue) which compiles and is tested: -``` +```go package queue import "github.com/cheekybits/genny/generic" @@ -148,7 +148,7 @@ cat source.go | genny gen "Something=string" It outputs: -``` +```go // This file was automatically generated by genny. // Any changes will be lost if this file is regenerated. // see https://github.com/cheekybits/genny @@ -187,7 +187,7 @@ Check out the [test code files](https://github.com/cheekybits/genny/tree/master/ Once you have defined a generic type with some code worth testing: -``` +```go package slice import ( @@ -216,7 +216,7 @@ func EnsureMyTypeSlice(objectOrSlice interface{}) []MyType { You can treat it like any normal Go type in your test code: -``` +```go func TestEnsureMyTypeSlice(t *testing.T) { myType := new(MyType)