Skip to content

Commit

Permalink
chore: move packages to pkg and main.go to cmd dir
Browse files Browse the repository at this point in the history
  • Loading branch information
raklaptudirm committed Feb 1, 2022
1 parent fcdccad commit 4d70a30
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 42 deletions.
8 changes: 4 additions & 4 deletions main.go → cmd/brainfuck/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ import (
"io/ioutil"
"os"

"github.com/raklaptudirm/brainfuck/help"
"github.com/raklaptudirm/brainfuck/pkg/help"

"github.com/raklaptudirm/brainfuck/errors"
"github.com/raklaptudirm/brainfuck/parser"
"github.com/raklaptudirm/brainfuck/vm"
"github.com/raklaptudirm/brainfuck/pkg/errors"
"github.com/raklaptudirm/brainfuck/pkg/parser"
"github.com/raklaptudirm/brainfuck/pkg/vm"
)

func main() {
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module github.com/raklaptudirm/brainfuck

go 1.16

require golang.org/x/tools v0.1.5 // indirect
29 changes: 0 additions & 29 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,29 +0,0 @@
github.com/yuin/goldmark v1.3.5 h1:dPmz1Snjq0kmkz159iL7S6WzdahUTHnHB5M56WFVifs=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions parser/parser.go → pkg/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"errors"
"fmt"

. "github.com/raklaptudirm/brainfuck/errors/types"
. "github.com/raklaptudirm/brainfuck/pkg/errors/types"
)

// Instruction type represents a single brainfuck instuction
Expand All @@ -38,7 +38,7 @@ const (

type Bytecode struct {
Instructions []Instruction
Indexes []LoopIndexes
Indexes []LoopIndexes
}

// Parse parses the given brainfuck source,
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions vm/vm.go → pkg/vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"fmt"
"io"

"github.com/raklaptudirm/brainfuck/parser"
. "github.com/raklaptudirm/brainfuck/vm/types"
"github.com/raklaptudirm/brainfuck/pkg/parser"
. "github.com/raklaptudirm/brainfuck/pkg/vm/types"
)

// VM struct to store memory information during runtime.
Expand Down
7 changes: 4 additions & 3 deletions vm/wrappers.go → pkg/vm/wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package vm
import (
"io"
"io/ioutil"
"github.com/raklaptudirm/brainfuck/errors"
"github.com/raklaptudirm/brainfuck/parser"

"github.com/raklaptudirm/brainfuck/pkg/errors"
"github.com/raklaptudirm/brainfuck/pkg/parser"
)

// RunString runs a given brainfuck source string,
Expand All @@ -23,4 +24,4 @@ func (vm *VM) RunFile(fileName string, out io.Writer) {
errors.StrictCheck(fileError)

vm.RunString(string(file), out)
}
}

0 comments on commit 4d70a30

Please sign in to comment.