File: example_test.go

package info (click to toggle)
golang-github-juju-names 4.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 340 kB
  • sloc: makefile: 14
file content (19 lines) | stat: -rw-r--r-- 362 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright 2014 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.

package names

import "fmt"

func ExampleParseTag() {
	tag, err := ParseTag("user-100")
	if err != nil {
		panic(err)
	}
	switch tag := tag.(type) {
	case UserTag:
		fmt.Printf("User tag, id: %s\n", tag.Id())
	default:
		fmt.Printf("Unknown tag, type %T\n", tag)
	}
}