Fix typo and clean up things
This commit is contained in:
parent
6cc73c97f7
commit
6a043360ff
|
@ -1,9 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="WEB_MODULE" version="4">
|
|
||||||
<component name="Go" enabled="true" />
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/captcha.iml" filepath="$PROJECT_DIR$/.idea/captcha.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -74,9 +74,9 @@ type SetOption func(*Options)
|
||||||
|
|
||||||
// Data is the result of captcha generation.
|
// Data is the result of captcha generation.
|
||||||
// It has a `Text` field and a private `img` field that will
|
// It has a `Text` field and a private `img` field that will
|
||||||
// be used in `WriteImage` receiver
|
// be used in `WriteImage` receiver.
|
||||||
type Data struct {
|
type Data struct {
|
||||||
// Text is captcha solution
|
// Text is captcha solution.
|
||||||
Text string
|
Text string
|
||||||
|
|
||||||
img *image.NRGBA
|
img *image.NRGBA
|
||||||
|
@ -122,7 +122,7 @@ func LoadFontFromReader(reader io.Reader) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// New creates a new captcha.
|
// New creates a new captcha.
|
||||||
// It returns captcha data and any freetype drawing error encountered
|
// It returns captcha data and any freetype drawing error encountered.
|
||||||
func New(width int, height int, option ...SetOption) (*Data, error) {
|
func New(width int, height int, option ...SetOption) (*Data, error) {
|
||||||
options := newDefaultOption(width, height)
|
options := newDefaultOption(width, height)
|
||||||
for _, setOption := range option {
|
for _, setOption := range option {
|
||||||
|
@ -143,7 +143,7 @@ func New(width int, height int, option ...SetOption) (*Data, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMathExpr creates a new captcha.
|
// NewMathExpr creates a new captcha.
|
||||||
// It will generate a image with a math expression like `1 + 2`
|
// It will generate a image with a math expression like `1 + 2`.
|
||||||
func NewMathExpr(width int, height int, option ...SetOption) (*Data, error) {
|
func NewMathExpr(width int, height int, option ...SetOption) (*Data, error) {
|
||||||
options := newDefaultOption(width, height)
|
options := newDefaultOption(width, height)
|
||||||
for _, setOption := range option {
|
for _, setOption := range option {
|
||||||
|
|
|
@ -2,9 +2,10 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/steambap/captcha"
|
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/steambap/captcha"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -2,10 +2,11 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/steambap/captcha"
|
|
||||||
"golang.org/x/image/font/gofont/goregular"
|
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/steambap/captcha"
|
||||||
|
"golang.org/x/image/font/gofont/goregular"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
Reference in New Issue