iperf3exporter/vendor/github.com/go-toolsmith/strparse
Marvin Preuss 2343c9588a
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is failing
first commit
2021-10-20 10:08:56 +02:00
..
.travis.yml first commit 2021-10-20 10:08:56 +02:00
LICENSE first commit 2021-10-20 10:08:56 +02:00
README.md first commit 2021-10-20 10:08:56 +02:00
strparse.go first commit 2021-10-20 10:08:56 +02:00

Go Report Card GoDoc Build Status

strparse

Package strparse provides convenience wrappers around go/parser for simple expression, statement and declaretion parsing from string.

Installation

go get github.com/go-toolsmith/strparse

Example

package main

import (
	"go-toolsmith/astequal"
	"go-toolsmith/strparse"
)

func main() {
	// Comparing AST strings for equallity (note different spacing):
	x := strparse.Expr(`1 + f(v[0].X)`)
	y := strparse.Expr(` 1+f( v[0].X ) `)
	fmt.Println(astequal.Expr(x, y)) // => true
}