Skip to content

Instantly share code, notes, and snippets.

View rogpeppe's full-sized avatar

Roger Peppe rogpeppe

View GitHub Profile
package main
import (
"log"
"runtime"
)
func main() {
mkmap()
log.Println("before GC", runtime.MemStats.HeapAlloc)
package main
import (
"log"
"runtime"
)
func main() {
m := mkmap()
for _ = range m {
package main
import (
"fmt"
"runtime"
"testing"
)
func main() {
fmt.Printf("add %v\n", testing.Benchmark(benchAdd))
package main
import (
"log"
"runtime"
)
func main() {
m := mkmap()
for _ = range m {
@rogpeppe
rogpeppe / gist:874010
Created March 17, 2011 08:37
go map/slice/array benchmark
package main
import (
"fmt"
"testing"
)
const Size = 1e6
var (
array [Size]int
// isHTTPS reports whether the configuration
// is configured to use HTTPS.
func (config Config) isHTTPS() bool {
// Ignore any URL parsing error as that'll
// be handled by other code paths.
configURL, _ := url.Parse(config.URL)
return configURL != nil && configURL.Scheme == "https"
}

Introduction

This subordinate charm is used to configure nrpe (Nagios Remote Plugin Executor). It can be related to the nagios charm via the monitors relation and will pass a monitors yaml to nagios informing it of what checks to monitor.

Principal Relations

Refactoring Go code

One of the advantages of Go is that refactoring Go code is easier than in some other languages. This workshop will explore some of ways that Go code can be refactoried manually and automatically.

Why do we refactor code?

  • increasing code complexity
  • changing requirements

Refactoring Go code

One of the advantages of Go is that refactoring Go code is easier than in some other languages. This workshop will explore some of ways that Go code can be refactoried manually and automatically.

Why do we refactor code?

  • increasing code complexity
  • changing requirements