-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Description
Flaw in Go Documentation
This could be old documentation from an older version, but it no longer works and I'm including the reason and solution:
From the README.md
First download with go get -u github.com/miketheprogrammer/go-thrust/
package main
import (
"github.com/miketheprogrammer/go-thrust/dispatcher"
"github.com/miketheprogrammer/go-thrust/spawn"
"github.com/miketheprogrammer/go-thrust/window"
)
func main() {
spawn.Run()
thrustWindow := window.NewWindow("http://breach.cc/", nil)
thrustWindow.Show()
thrustWindow.Maximize()
thrustWindow.Focus()
dispatcher.RunLoop()
}Problem
thrustWindow := window.NewWindow("http://breach.cc/", nil)window.NewWindow() does not accept string type for the first parameter, but a new struct: "Options"
window.go
type Options struct {
RootUrl string
Size SizeHW
Title string
IconPath string
HasFrame bool
Session *session.Session
}commands.go
type SizeHW struct {
Width uint `json:"width,omitempty"`
Height uint `json:"height,omitempty"`
}By providing a struct for window.NewWindow() you can solve this issue.
Example Solution
import (
"github.com/miketheprogrammer/go-thrust/lib/dispatcher"
"github.com/miketheprogrammer/go-thrust/lib/spawn"
"github.com/miketheprogrammer/go-thrust/lib/bindings/window"
"github.com/miketheprogrammer/go-thrust/lib/commands" // NEW: Required struct SizeHW
)
func main() {
spawn.Run()
//thrustWindow := window.NewWindow("http://breach.cc/", nil) // OLD
thrustSize := commands.SizeHW{Width:1024, Height: 768} // NEW: SizeHW struct
thrustOptions := window.Options{RootUrl:"http://www.google.com/", Size: thrustSize} // NEW: Options struct
thrustWindow := window.NewWindow(thrustOptions) // NEW: Using the options
thrustWindow.Show()
thrustWindow.Maximize()
thrustWindow.Focus()
dispatcher.RunLoop()
}This is tested under Windows 10.
Metadata
Metadata
Assignees
Labels
No labels