OXIESEC PANEL
- Current Dir:
/
/
opt
/
golang
/
1.19.4
/
src
/
go
/
format
Server IP: 2a02:4780:11:1084:0:327f:3464:10
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
12/01/2022 06:13:56 PM
rwxr-xr-x
📄
benchmark_test.go
1.99 KB
12/01/2022 06:12:58 PM
rw-r--r--
📄
example_test.go
753 bytes
12/01/2022 06:12:58 PM
rw-r--r--
📄
format.go
4.29 KB
12/01/2022 06:12:58 PM
rw-r--r--
📄
format_test.go
4.46 KB
12/01/2022 06:12:58 PM
rw-r--r--
📄
internal.go
5.05 KB
12/01/2022 06:12:58 PM
rw-r--r--
Editing: example_test.go
Close
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package format_test import ( "bytes" "fmt" "go/format" "go/parser" "go/token" "log" ) func ExampleNode() { const expr = "(6+2*3)/4" // parser.ParseExpr parses the argument and returns the // corresponding ast.Node. node, err := parser.ParseExpr(expr) if err != nil { log.Fatal(err) } // Create a FileSet for node. Since the node does not come // from a real source file, fset will be empty. fset := token.NewFileSet() var buf bytes.Buffer err = format.Node(&buf, fset, node) if err != nil { log.Fatal(err) } fmt.Println(buf.String()) // Output: (6 + 2*3) / 4 }