mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Fix Go formatting in beam and dockerscript
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
This commit is contained in:
		
							parent
							
								
									0bf2109121
								
							
						
					
					
						commit
						bf51f36d8f
					
				
					 11 changed files with 56 additions and 71 deletions
				
			
		| 
						 | 
				
			
			@ -1,8 +1,8 @@
 | 
			
		|||
package beam
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"testing"
 | 
			
		||||
	"github.com/dotcloud/docker/pkg/beam/data"
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestSendConn(t *testing.T) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,8 +2,8 @@ package data
 | 
			
		|||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"strings"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func Encode(obj map[string][]string) string {
 | 
			
		||||
| 
						 | 
				
			
			@ -93,10 +93,10 @@ func decodeString(msg string) (string, int, error) {
 | 
			
		|||
	} else {
 | 
			
		||||
		length = int(l)
 | 
			
		||||
	}
 | 
			
		||||
	if len(parts[1]) < length + 1 {
 | 
			
		||||
		return "", 0, fmt.Errorf("message '%s' is %d bytes, expected at least %d", parts[1], len(parts[1]), length + 1)
 | 
			
		||||
	if len(parts[1]) < length+1 {
 | 
			
		||||
		return "", 0, fmt.Errorf("message '%s' is %d bytes, expected at least %d", parts[1], len(parts[1]), length+1)
 | 
			
		||||
	}
 | 
			
		||||
	payload := parts[1][:length + 1]
 | 
			
		||||
	payload := parts[1][:length+1]
 | 
			
		||||
	if payload[length] != ',' {
 | 
			
		||||
		return "", 0, fmt.Errorf("message is not comma-terminated")
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -92,10 +92,10 @@ func TestEncodeBinaryValue(t *testing.T) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
func TestDecodeString(t *testing.T) {
 | 
			
		||||
	validEncodedStrings := []struct{
 | 
			
		||||
		input string
 | 
			
		||||
	validEncodedStrings := []struct {
 | 
			
		||||
		input  string
 | 
			
		||||
		output string
 | 
			
		||||
		skip int
 | 
			
		||||
		skip   int
 | 
			
		||||
	}{
 | 
			
		||||
		{"3:foo,", "foo", 6},
 | 
			
		||||
		{"5:hello,", "hello", 8},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										
											BIN
										
									
								
								pkg/beam/examples/beamsh/beamsh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								pkg/beam/examples/beamsh/beamsh
									
										
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -2,6 +2,7 @@ package main
 | 
			
		|||
 | 
			
		||||
import (
 | 
			
		||||
	"bufio"
 | 
			
		||||
	"flag"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"github.com/dotcloud/docker/pkg/beam"
 | 
			
		||||
	"github.com/dotcloud/docker/pkg/beam/data"
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +15,6 @@ import (
 | 
			
		|||
	"path"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"sync"
 | 
			
		||||
	"flag"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var rootPlugins = []string{
 | 
			
		||||
| 
						 | 
				
			
			@ -22,8 +22,8 @@ var rootPlugins = []string{
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	flX bool
 | 
			
		||||
	flPing bool
 | 
			
		||||
	flX        bool
 | 
			
		||||
	flPing     bool
 | 
			
		||||
	introspect beam.ReceiveSender = beam.Devnull()
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -38,7 +38,7 @@ func main() {
 | 
			
		|||
	fd3.Close()
 | 
			
		||||
	flag.BoolVar(&flX, "x", false, "print commands as they are being executed")
 | 
			
		||||
	flag.Parse()
 | 
			
		||||
	if flag.NArg() == 0{
 | 
			
		||||
	if flag.NArg() == 0 {
 | 
			
		||||
		if term.IsTerminal(0) {
 | 
			
		||||
			// No arguments, stdin is terminal --> interactive mode
 | 
			
		||||
			input := bufio.NewScanner(os.Stdin)
 | 
			
		||||
| 
						 | 
				
			
			@ -168,7 +168,6 @@ func executeScript(out beam.Sender, script []*dockerscript.Command) error {
 | 
			
		|||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//	1) Find a handler for the command (if no handler, fail)
 | 
			
		||||
//	2) Attach new in & out pair to the handler
 | 
			
		||||
//	3) [in the background] Copy handler output to our own output
 | 
			
		||||
| 
						 | 
				
			
			@ -217,10 +216,8 @@ func executeCommand(out beam.Sender, cmd *dockerscript.Command) error {
 | 
			
		|||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
type Handler func([]string, io.Writer, io.Writer, beam.Receiver, beam.Sender)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func Handlers(sink beam.Sender) (*beam.UnixConn, error) {
 | 
			
		||||
	var tasks sync.WaitGroup
 | 
			
		||||
	pub, priv, err := beam.USocketPair()
 | 
			
		||||
| 
						 | 
				
			
			@ -329,11 +326,12 @@ func GetHandler(name string) Handler {
 | 
			
		|||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// VARIOUS HELPER FUNCTIONS:
 | 
			
		||||
 | 
			
		||||
func connToFile(conn net.Conn) (f *os.File, err error) {
 | 
			
		||||
	if connWithFile, ok := conn.(interface { File() (*os.File, error) }); !ok {
 | 
			
		||||
	if connWithFile, ok := conn.(interface {
 | 
			
		||||
		File() (*os.File, error)
 | 
			
		||||
	}); !ok {
 | 
			
		||||
		return nil, fmt.Errorf("no file descriptor available")
 | 
			
		||||
	} else {
 | 
			
		||||
		f, err = connWithFile.File()
 | 
			
		||||
| 
						 | 
				
			
			@ -345,12 +343,12 @@ func connToFile(conn net.Conn) (f *os.File, err error) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
type Msg struct {
 | 
			
		||||
	payload		[]byte
 | 
			
		||||
	attachment	*os.File
 | 
			
		||||
	payload    []byte
 | 
			
		||||
	attachment *os.File
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Logf(msg string, args ...interface{}) (int, error) {
 | 
			
		||||
	if len(msg) == 0 || msg[len(msg) - 1] != '\n' {
 | 
			
		||||
	if len(msg) == 0 || msg[len(msg)-1] != '\n' {
 | 
			
		||||
		msg = msg + "\n"
 | 
			
		||||
	}
 | 
			
		||||
	msg = fmt.Sprintf("[%v] [%v] %s", os.Getpid(), path.Base(os.Args[0]), msg)
 | 
			
		||||
| 
						 | 
				
			
			@ -363,7 +361,7 @@ func Debugf(msg string, args ...interface{}) {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Fatalf(msg string, args ...interface{})  {
 | 
			
		||||
func Fatalf(msg string, args ...interface{}) {
 | 
			
		||||
	Logf(msg, args...)
 | 
			
		||||
	os.Exit(1)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -386,7 +384,6 @@ func scriptString(script []*dockerscript.Command) string {
 | 
			
		|||
	return fmt.Sprintf("'%s'", strings.Join(lines, "; "))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func dialer(addr string) (chan net.Conn, error) {
 | 
			
		||||
	u, err := url.Parse(addr)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
| 
						 | 
				
			
			@ -400,7 +397,7 @@ func dialer(addr string) (chan net.Conn, error) {
 | 
			
		|||
			if err != nil {
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			connections <-conn
 | 
			
		||||
			connections <- conn
 | 
			
		||||
		}
 | 
			
		||||
	}()
 | 
			
		||||
	return connections, nil
 | 
			
		||||
| 
						 | 
				
			
			@ -424,14 +421,12 @@ func listener(addr string) (chan net.Conn, error) {
 | 
			
		|||
				return
 | 
			
		||||
			}
 | 
			
		||||
			Logf("new connection\n")
 | 
			
		||||
			connections<-conn
 | 
			
		||||
			connections <- conn
 | 
			
		||||
		}
 | 
			
		||||
	}()
 | 
			
		||||
	return connections, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func SendToConn(connections chan net.Conn, src beam.Receiver) error {
 | 
			
		||||
	var tasks sync.WaitGroup
 | 
			
		||||
	defer tasks.Wait()
 | 
			
		||||
| 
						 | 
				
			
			@ -479,14 +474,13 @@ func SendToConn(connections chan net.Conn, src beam.Receiver) error {
 | 
			
		|||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func msgDesc(payload []byte, attachment *os.File) string {
 | 
			
		||||
	return beam.MsgDesc(payload, attachment)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func ReceiveFromConn(connections chan net.Conn, dst beam.Sender) error {
 | 
			
		||||
	for conn := range connections {
 | 
			
		||||
		err := func () error {
 | 
			
		||||
		err := func() error {
 | 
			
		||||
			Logf("parsing message from network...\n")
 | 
			
		||||
			defer Logf("done parsing message from network\n")
 | 
			
		||||
			buf := make([]byte, 4098)
 | 
			
		||||
| 
						 | 
				
			
			@ -534,7 +528,6 @@ func ReceiveFromConn(connections chan net.Conn, dst beam.Sender) error {
 | 
			
		|||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func bicopy(a, b io.ReadWriteCloser) {
 | 
			
		||||
	var iotasks sync.WaitGroup
 | 
			
		||||
	oneCopy := func(dst io.WriteCloser, src io.Reader) {
 | 
			
		||||
| 
						 | 
				
			
			@ -547,4 +540,3 @@ func bicopy(a, b io.ReadWriteCloser) {
 | 
			
		|||
	go oneCopy(b, a)
 | 
			
		||||
	iotasks.Wait()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,24 +1,23 @@
 | 
			
		|||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"io"
 | 
			
		||||
	"os/exec"
 | 
			
		||||
	"bufio"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"github.com/dotcloud/docker/pkg/beam"
 | 
			
		||||
	"github.com/dotcloud/docker/pkg/beam/data"
 | 
			
		||||
	"github.com/dotcloud/docker/pkg/term"
 | 
			
		||||
	"github.com/dotcloud/docker/utils"
 | 
			
		||||
	"text/template"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"sync"
 | 
			
		||||
	"os"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"path"
 | 
			
		||||
	"bufio"
 | 
			
		||||
	"io"
 | 
			
		||||
	"net"
 | 
			
		||||
	"net/url"
 | 
			
		||||
	"os"
 | 
			
		||||
	"os/exec"
 | 
			
		||||
	"path"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"sync"
 | 
			
		||||
	"text/template"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func CmdLogger(args []string, stdout, stderr io.Writer, in beam.Receiver, out beam.Sender) {
 | 
			
		||||
	if err := os.MkdirAll("logs", 0700); err != nil {
 | 
			
		||||
		fmt.Fprintf(stderr, "%v\n", err)
 | 
			
		||||
| 
						 | 
				
			
			@ -28,7 +27,7 @@ func CmdLogger(args []string, stdout, stderr io.Writer, in beam.Receiver, out be
 | 
			
		|||
	defer tasks.Wait()
 | 
			
		||||
	var n int = 1
 | 
			
		||||
	r := beam.NewRouter(out)
 | 
			
		||||
	r.NewRoute().HasAttachment().KeyStartsWith("cmd", "log").Handler(func (payload []byte, attachment *os.File) error {
 | 
			
		||||
	r.NewRoute().HasAttachment().KeyStartsWith("cmd", "log").Handler(func(payload []byte, attachment *os.File) error {
 | 
			
		||||
		tasks.Add(1)
 | 
			
		||||
		go func(n int) {
 | 
			
		||||
			defer tasks.Done()
 | 
			
		||||
| 
						 | 
				
			
			@ -398,7 +397,7 @@ func CmdConnect(args []string, stdout, stderr io.Writer, in beam.Receiver, out b
 | 
			
		|||
		Logf("connecting to %s/%s\n", u.Scheme, u.Host)
 | 
			
		||||
		conn, err := net.Dial(u.Scheme, u.Host)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			out.Send(data.Empty().Set("cmd", "msg", "connect error: " + err.Error()).Bytes(), nil)
 | 
			
		||||
			out.Send(data.Empty().Set("cmd", "msg", "connect error: "+err.Error()).Bytes(), nil)
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		out.Send(data.Empty().Set("cmd", "msg", "connection established").Bytes(), nil)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,19 +1,19 @@
 | 
			
		|||
package beam
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"io"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"os"
 | 
			
		||||
	"github.com/dotcloud/docker/pkg/beam/data"
 | 
			
		||||
	"io"
 | 
			
		||||
	"os"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Router struct {
 | 
			
		||||
	routes []*Route
 | 
			
		||||
	sink Sender
 | 
			
		||||
	sink   Sender
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewRouter(sink Sender) *Router {
 | 
			
		||||
	return &Router{sink:sink}
 | 
			
		||||
	return &Router{sink: sink}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Router) Send(payload []byte, attachment *os.File) (err error) {
 | 
			
		||||
| 
						 | 
				
			
			@ -40,10 +40,8 @@ func (r *Router) NewRoute() *Route {
 | 
			
		|||
	return route
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
type Route struct {
 | 
			
		||||
	rules []func([]byte, *os.File) bool
 | 
			
		||||
	rules   []func([]byte, *os.File) bool
 | 
			
		||||
	handler func([]byte, *os.File) error
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -70,7 +68,6 @@ func (r *Route) HasAttachment() *Route {
 | 
			
		|||
	return r
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func (route *Route) Tee(dst Sender) *Route {
 | 
			
		||||
	inner := route.handler
 | 
			
		||||
	route.handler = func(payload []byte, attachment *os.File) error {
 | 
			
		||||
| 
						 | 
				
			
			@ -125,8 +122,7 @@ func (r *Route) KeyStartsWith(k string, beginning ...string) *Route {
 | 
			
		|||
	return r
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func (r *Route) KeyEquals(k string, full...string) *Route {
 | 
			
		||||
func (r *Route) KeyEquals(k string, full ...string) *Route {
 | 
			
		||||
	r.rules = append(r.rules, func(payload []byte, attachment *os.File) bool {
 | 
			
		||||
		values := data.Message(payload).Get(k)
 | 
			
		||||
		if len(values) != len(full) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,13 +3,13 @@ package beam
 | 
			
		|||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io/ioutil"
 | 
			
		||||
	"testing"
 | 
			
		||||
	"os"
 | 
			
		||||
	"sync"
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type msg struct {
 | 
			
		||||
	payload []byte
 | 
			
		||||
	payload    []byte
 | 
			
		||||
	attachment *os.File
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -17,7 +17,6 @@ func (m msg) String() string {
 | 
			
		|||
	return MsgDesc(m.payload, m.attachment)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
type mockReceiver []msg
 | 
			
		||||
 | 
			
		||||
func (r *mockReceiver) Send(p []byte, a *os.File) error {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,11 +1,11 @@
 | 
			
		|||
package beam
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bufio"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"net"
 | 
			
		||||
	"os"
 | 
			
		||||
	"syscall"
 | 
			
		||||
	"bufio"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func debugCheckpoint(msg string, args ...interface{}) {
 | 
			
		||||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ func debugCheckpoint(msg string, args ...interface{}) {
 | 
			
		|||
		return
 | 
			
		||||
	}
 | 
			
		||||
	os.Stdout.Sync()
 | 
			
		||||
	tty,_ := os.OpenFile("/dev/tty", os.O_RDWR, 0700)
 | 
			
		||||
	tty, _ := os.OpenFile("/dev/tty", os.O_RDWR, 0700)
 | 
			
		||||
	fmt.Fprintf(tty, msg, args...)
 | 
			
		||||
	bufio.NewScanner(tty).Scan()
 | 
			
		||||
	tty.Close()
 | 
			
		||||
| 
						 | 
				
			
			@ -170,7 +170,7 @@ func SocketPair() (a *os.File, b *os.File, err error) {
 | 
			
		|||
 | 
			
		||||
func USocketPair() (*UnixConn, *UnixConn, error) {
 | 
			
		||||
	debugCheckpoint("===DEBUG=== USocketPair(). Hit enter to confirm: ")
 | 
			
		||||
	defer debugCheckpoint ("===DEBUG=== USocketPair() returned. Hit enter to confirm ")
 | 
			
		||||
	defer debugCheckpoint("===DEBUG=== USocketPair() returned. Hit enter to confirm ")
 | 
			
		||||
	a, b, err := SocketPair()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, nil, err
 | 
			
		||||
| 
						 | 
				
			
			@ -193,7 +193,7 @@ func USocketPair() (*UnixConn, *UnixConn, error) {
 | 
			
		|||
// returns an error if the file descriptor does not point to a unix socket.
 | 
			
		||||
// This creates a duplicate file descriptor. It's the caller's responsibility
 | 
			
		||||
// to close both.
 | 
			
		||||
func FdConn(fd int) (n*net.UnixConn, err error) {
 | 
			
		||||
func FdConn(fd int) (n *net.UnixConn, err error) {
 | 
			
		||||
	{
 | 
			
		||||
		debugCheckpoint("===DEBUG=== FdConn([%d]) = (unknown fd). Hit enter to confirm: ", fd)
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,15 +1,15 @@
 | 
			
		|||
package dockerscript
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/dotcloud/docker/pkg/dockerscript/scanner"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"github.com/dotcloud/docker/pkg/dockerscript/scanner"
 | 
			
		||||
	"io"
 | 
			
		||||
	"strings"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Command struct {
 | 
			
		||||
	Args []string
 | 
			
		||||
	Children []*Command
 | 
			
		||||
	Args       []string
 | 
			
		||||
	Children   []*Command
 | 
			
		||||
	Background bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -32,7 +32,7 @@ func Parse(src io.Reader) ([]*Command, error) {
 | 
			
		|||
 | 
			
		||||
func (cmd *Command) subString(depth int) string {
 | 
			
		||||
	var prefix string
 | 
			
		||||
	for i:=0; i<depth; i++ {
 | 
			
		||||
	for i := 0; i < depth; i++ {
 | 
			
		||||
		prefix += "  "
 | 
			
		||||
	}
 | 
			
		||||
	s := prefix + strings.Join(cmd.Args, ", ")
 | 
			
		||||
| 
						 | 
				
			
			@ -85,12 +85,12 @@ func parseArgs(s *Scanner) ([]string, rune, error) {
 | 
			
		|||
 | 
			
		||||
func parse(s *Scanner, opener string) (expr []*Command, err error) {
 | 
			
		||||
	/*
 | 
			
		||||
	defer func() {
 | 
			
		||||
		fmt.Printf("parse() returned %d commands:\n", len(expr))
 | 
			
		||||
		for _, c := range expr {
 | 
			
		||||
			fmt.Printf("\t----> %s\n", c)
 | 
			
		||||
		}
 | 
			
		||||
	}()
 | 
			
		||||
		defer func() {
 | 
			
		||||
			fmt.Printf("parse() returned %d commands:\n", len(expr))
 | 
			
		||||
			for _, c := range expr {
 | 
			
		||||
				fmt.Printf("\t----> %s\n", c)
 | 
			
		||||
			}
 | 
			
		||||
		}()
 | 
			
		||||
	*/
 | 
			
		||||
	for {
 | 
			
		||||
		args, tok, err := parseArgs(s)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,8 @@
 | 
			
		|||
package scanner
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"unicode"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"unicode"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// extra functions used to hijack the upstream text/scanner
 | 
			
		||||
| 
						 | 
				
			
			@ -19,4 +19,3 @@ func detectIdent(ch rune) bool {
 | 
			
		|||
	}
 | 
			
		||||
	return false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue