source

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package source helps deal with Go source code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenameChannel

func RenameChannel(src, funcname, from, to string) (string, error)

RenameChannel renames a package-level channel variable in a snippet of code.

Types

type StringSet

type StringSet map[string]struct{}

StringSet stores an unordered set of strings.

func ExtractChannels

func ExtractChannels(src, funcname, defs string) (read, written StringSet, err error)

ExtractChannels extracts channel names used. The channel definitions are compared against definitions in defs, to avoid false positives (shadowed, ranging over non-channels).

func NewStringSet

func NewStringSet(values ...string) StringSet

NewStringSet creates a StringSet with some elements.

func Union

func Union(sets ...StringSet) StringSet

Union returns a set containing all elements in any of the input sets.

func (StringSet) Add

func (s StringSet) Add(x string)

Add adds an element to a StringSet

func (StringSet) Del

func (s StringSet) Del(x string)

Del removes an element from a StringSet

func (StringSet) Ni

func (s StringSet) Ni(x string) bool

Ni checks if an element is in the set.

func (StringSet) Slice

func (s StringSet) Slice() []string

Slice returns the elements in a slice, sorted.

func (StringSet) String

func (s StringSet) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL