Skip to content
/ walk Public

A golang package to apply a function recursive to all (strings|ints|...) on a value

License

Notifications You must be signed in to change notification settings

fvosberg/walk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is walk?

Walk provides an easy and type safe way to manipulate all fields of the same type of a variable in Go (Golang). Look at the How to use walk.

Installing

The easiest way to get walk is go getting it

go get github.com/fvosberg/walk

How to use walk

Walk over strings

To manipulate all strings in a given variable you can use the following code

u := User{
	FirstName: "*** Random ***",
	LastName: "*** Guy ***",
	Email: "[email protected]",
}
walk.Strings(u, func(s string) string {
	return strings.Trim(s, " *")
})
fmt.Printf("After processing: %#v")
// User{FirstName:"Random", LastName:"Guy", Email:"[email protected]"}

About

A golang package to apply a function recursive to all (strings|ints|...) on a value

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages