Skip to content

Commit

Permalink
Merge pull request #30 from go-generalize/chore/minor-update
Browse files Browse the repository at this point in the history
Chore minor update
  • Loading branch information
54m committed Dec 9, 2022
2 parents ec993ef + a844875 commit dc6fb9a
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 99 deletions.
24 changes: 24 additions & 0 deletions .gitignore
@@ -0,0 +1,24 @@
# IntelliJ project files
.idea
*.iml
out
gen

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# macOS
.DS_Store
2 changes: 1 addition & 1 deletion basic.go
@@ -1,4 +1,4 @@
// package easyparser provides a Go module parser for TypeScript AST
// Package easyparser provides a Go module parser for AST
package easyparser

import (
Expand Down
2 changes: 1 addition & 1 deletion const.go
@@ -1,4 +1,4 @@
// package easyparser provides a Go module parser for TypeScript AST
// Package easyparser provides a Go module parser for AST
package easyparser

import (
Expand Down
8 changes: 6 additions & 2 deletions go.mod
Expand Up @@ -3,9 +3,13 @@ module github.com/go-generalize/go-easyparser
go 1.17

require (
github.com/go-utils/gopackages v0.0.0-20210218102646-e7d1f0008968
github.com/google/go-cmp v0.5.9
golang.org/x/mod v0.7.0
golang.org/x/tools v0.4.0
)

require golang.org/x/sys v0.3.0 // indirect
require (
golang.org/x/mod v0.7.0 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
)
9 changes: 9 additions & 0 deletions go.sum
@@ -1,11 +1,16 @@
github.com/go-utils/gopackages v0.0.0-20210218102646-e7d1f0008968 h1:sHm78LgJXVdlQPfpmVq4tLmssocz+tda7NJgdH6LJFY=
github.com/go-utils/gopackages v0.0.0-20210218102646-e7d1f0008968/go.mod h1:QPVW4BzGDze3cEu7TbM7Gw9ppfYTj4NDgBW0JwNZE1g=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
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/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
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-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
Expand All @@ -15,6 +20,7 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/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-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand All @@ -34,3 +40,6 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
golang.org/x/tools v0.4.0 h1:7mTAgkunk3fr4GAloyyCasadO6h9zSsQZbwvcaIciV4=
golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ=
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=
2 changes: 1 addition & 1 deletion opt.go
@@ -1,4 +1,4 @@
// package easyparser provides a Go module parser for TypeScript AST
// Package easyparser provides a Go module parser for AST
package easyparser

// FilterOpt is options to filter exported interfaces
Expand Down
10 changes: 5 additions & 5 deletions parser.go
@@ -1,4 +1,4 @@
// package easyparser provides a Go module parser for TypeScript AST
// Package easyparser provides a Go module parser for AST
package easyparser

import (
Expand All @@ -9,7 +9,7 @@ import (
"reflect"

tstypes "github.com/go-generalize/go-easyparser/types"
"github.com/go-generalize/go-easyparser/util"
"github.com/go-utils/gopackages"
"golang.org/x/tools/go/packages"
)

Expand All @@ -28,14 +28,14 @@ type Parser struct {
}

func getPackagePath(dir string) (root string, pkg string, err error) {
goModPath, err := util.GetGoModPath(dir)
goModPath, err := gopackages.GetGoModPath(dir)

if err != nil {
return "", "", err
}
goModDir := filepath.Dir(goModPath)

mod, err := util.GetGoModule(goModPath)
mod, err := gopackages.GetGoModule(goModPath)

if err != nil {
return "", "", err
Expand Down Expand Up @@ -309,7 +309,7 @@ func (p *pkgParser) parseMap(u *types.Map) tstypes.Type {
}
}

func (p *pkgParser) parseInterface(u *types.Interface) tstypes.Type {
func (p *pkgParser) parseInterface(_ *types.Interface) tstypes.Type {
return &tstypes.Any{}
}

Expand Down
2 changes: 1 addition & 1 deletion struct.go
@@ -1,4 +1,4 @@
// package easyparser provides a Go module parser for TypeScript AST
// Package easyparser provides a Go module parser for AST
package easyparser

import (
Expand Down
2 changes: 1 addition & 1 deletion types/number.go
Expand Up @@ -53,7 +53,7 @@ func (e *Number) AddCandidates(key string, v interface{}) {
})
}

// SetName sets a alternative name
// SetName sets an alternative name
func (e *Number) SetName(name string) {
e.Name = name
}
Expand Down
4 changes: 2 additions & 2 deletions types/object.go
Expand Up @@ -3,7 +3,7 @@ package types

import "go/token"

// ObjectEntry is an field in objects
// ObjectEntry is a field in objects
type ObjectEntry struct {
RawName string
RawTag string
Expand All @@ -30,7 +30,7 @@ func (n *Object) UsedAsMapKey() bool {
return false
}

// SetName sets a alternative name
// SetName sets an alternative name
func (n *Object) SetName(name string) {
n.Name = name
}
Expand Down
2 changes: 1 addition & 1 deletion types/string.go
Expand Up @@ -47,7 +47,7 @@ func (n *String) AddCandidates(key string, v interface{}) {
}
}

// SetName sets a alternative name
// SetName sets an alternative name
func (n *String) SetName(name string) {
n.Name = name
}
Expand Down
2 changes: 1 addition & 1 deletion types/types.go
Expand Up @@ -31,7 +31,7 @@ func (c *Common) GetPosition() *token.Position {
return c.Position
}

// Type interface represents all TypeScript types handled by go2ts
// Type interface represents all TypeScript types handled by go-easyparser
type Type interface {
SetPackageName(pkgName string)
GetPackageName() string
Expand Down
4 changes: 2 additions & 2 deletions util.go
@@ -1,4 +1,4 @@
// package easyparser provides a Go module parser for TypeScript AST
// Package easyparser provides a Go module parser for AST
package easyparser

import (
Expand All @@ -9,7 +9,7 @@ import (
)

func visitErrors(pkgs []*packages.Package) error {
errs := []string{}
errs := make([]string, 0)
packages.Visit(pkgs, nil, func(pkg *packages.Package) {
for i := range pkg.Errors {
errs = append(errs, pkg.Errors[i].Error())
Expand Down
81 changes: 0 additions & 81 deletions util/util.go

This file was deleted.

0 comments on commit dc6fb9a

Please sign in to comment.