Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
github.com/incu6us/goimports-reviser/v2
Russian warship, go f*ck yourself!
Tool for Golang to sort goimports by 3-4 groups(with own linter): std, general, local(which is optional) and project dependencies.
Also, formatting for your code will be prepared(so, you don't need to use gofmt
or goimports
separately).
Use additional options -rm-unused
to remove unused imports and -set-alias
to rewrite import aliases for versioned packages or for packages with additional prefix/suffix(example: opentracing "github.com/opentracing/opentracing-go"
).
-local
- will create group for local imports. Values should be comma-separated.
goimports-reviser -file-path ./reviser/reviser.go -rm-unused -set-alias -format
Usage of goimports-reviser:
-file-path string
File path to fix imports(ex.: ./reviser/reviser.go). Required parameter.
-format
Option will perform additional formatting. Optional parameter.
-list-diff
Option will list-diff files whose formatting differs from goimports-reviser. Optional parameter.
-local string
Local package prefixes which will be placed after 3rd-party group(if defined). Values should be comma-separated. Optional parameters.
-output string
Can be "file", "write" or "stdout". Whether to write the formatted content back to the file or to stdout. When "write" together with "-list-diff" will list the file name and write back to the file. Optional parameter. (default "file")
-project-name string
Your project name(ex.: github.com/incu6us/goimports-reviser). Optional parameter.
-rm-unused
Remove unused imports. Optional parameter.
-set-alias
Set alias for versioned package names, like 'github.com/go-pg/pg/v9'. In this case import will be set as 'pg "github.com/go-pg/pg/v9"'. Optional parameter.
-set-exit-status
set the exit status to 1 if a change is needed/made. Optional parameter.
brew tap incu6us/homebrew-tap
brew install incu6us/homebrew-tap/goimports-reviser
snap install goimports-reviser
Before usage:
package testdata
import (
"log"
"github.com/incu6us/goimports-reviser/testdata/innderpkg"
"bytes"
"github.com/pkg/errors"
)
After usage:
package testdata
import (
"bytes"
"log"
"github.com/pkg/errors"
"github.com/incu6us/goimports-reviser/testdata/innderpkg"
)
Comments(not Docs) for imports is acceptable. Example:
package testdata
import (
"fmt" // comments to the package here
)
-local
-optionBefore usage:
package testdata // goimports-reviser/testdata
import (
"fmt" //fmt package
"github.com/pkg/errors" //custom package
"github.com/incu6us/goimports-reviser/pkg" // this is a local package which is not a part of the project
"goimports-reviser/pkg"
)
After usage:
package testdata // goimports-reviser/testdata
import (
"fmt" // fmt package
"github.com/pkg/errors" // custom package
"github.com/incu6us/goimports-reviser/pkg" // this is a local package which is not a part of the project
"goimports-reviser/pkg"
)
-format
-optionBefore usage:
package main
func test(){
}
func additionalTest(){
}
After usage:
package main
func test(){
}
func additionalTest(){
}
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.