Skip to content

Some tiny golang utilities which can be used for debugging purpose

License

Notifications You must be signed in to change notification settings

sp-magicspells/go_utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

go_utils

Some tiny golang utilities which can be used for debugging purpose

	listener, err := net.Listen("tcp4", "127.0.0.1:0")
	if err != nil {
		fmt.Printf("error: %v\n", err)
		return
	}
	defer listener.Close()
	port := listener.Addr().(*net.TCPAddr).Port
	fmt.Printf("port found: %d\n", port)
}

Above utily in main.go can be used to debug port not available issue most of developers experience. you can run it by go run main.go and if successful, it should print a random port number instead of failing with an error.

Some more utils will be added soon.

About

Some tiny golang utilities which can be used for debugging purpose

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages