From c7d7f10bdff703e4a3c0414e8a33d4e45c91eb35 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 4 Jul 2020 11:12:55 +0200 Subject: go.mod: vendor golangci-lint --- vendor/github.com/go-toolsmith/astcopy/README.md | 41 ++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 vendor/github.com/go-toolsmith/astcopy/README.md (limited to 'vendor/github.com/go-toolsmith/astcopy/README.md') diff --git a/vendor/github.com/go-toolsmith/astcopy/README.md b/vendor/github.com/go-toolsmith/astcopy/README.md new file mode 100644 index 000000000..4dae5c41b --- /dev/null +++ b/vendor/github.com/go-toolsmith/astcopy/README.md @@ -0,0 +1,41 @@ +[![Go Report Card](https://goreportcard.com/badge/github.com/go-toolsmith/astcopy)](https://goreportcard.com/report/github.com/go-toolsmith/astcopy) +[![GoDoc](https://godoc.org/github.com/go-toolsmith/astcopy?status.svg)](https://godoc.org/github.com/go-toolsmith/astcopy) +[![Build Status](https://travis-ci.org/go-toolsmith/astcopy.svg?branch=master)](https://travis-ci.org/go-toolsmith/astcopy) + +# astcopy + +Package astcopy implements Go AST reflection-free deep copy operations. + +## Installation: + +```bash +go get github.com/go-toolsmith/astcopy +``` + +## Example + +```go +package main + +import ( + "fmt" + "go/ast" + "go/token" + + "github.com/go-toolsmith/astcopy" + "github.com/go-toolsmith/astequal" + "github.com/go-toolsmith/strparse" +) + +func main() { + x := strparse.Expr(`1 + 2`).(*ast.BinaryExpr) + y := astcopy.BinaryExpr(x) + fmt.Println(astequal.Expr(x, y)) // => true + + // Now modify x and make sure y is not modified. + z := astcopy.BinaryExpr(y) + x.Op = token.SUB + fmt.Println(astequal.Expr(y, z)) // => true + fmt.Println(astequal.Expr(x, y)) // => false +} +``` -- cgit mrf-deployment