gopython

module
v0.0.0-...-e2704b4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2025 License: MIT

README

gopython

Let you write go as if you were writing Python.

Golang is garbage, you'd better use Python for your safety.

You may want to kill yourself at sometimes if you persistent to use Golang.

Usage

go get github.com/yingshaoxo/gopython

Compile

You know what? You can use golang1.10.8 in both windowsXP and old linux to build linux software.

You just need to create a new folder and put your main go file into it, then inside of that folder, you do following:

CGO_ENABLED=0 GOOS=linux GOARCH=386 wine go.exe build -a -ldflags '-extldflags "-static"' -o test.run ./
Try-Catch
package main

import (
	"log"
	"fmt"

	error_tool "github.com/yingshaoxo/gopython/error_tool"
)

func main() {
	error_tool.Try(func() {
		i := 3
		for i != -1 {
			result := 100 / i
			fmt.Println(result, i)

			i -= 1
		}
	}).Catch(func(err string) {
		log.Println(err)
	})
}
Nullable
package main

import (
	"fmt"

	variable_tool "github.com/yingshaoxo/gopython/variable_tool"
)

func main() {
	hi := "hi"
	ok := "ok"

	a_string := variable_tool.Nullable(&hi)
	a_string.Is_null = true
	fmt.Println(*a_string.Value)
	fmt.Println(a_string.Is_null)

	a_string.Value = &ok
	a_string.Is_null = false
	fmt.Println(*a_string.Value)
	fmt.Println(a_string.Is_null)
}
JWT (json web token)
package main

import (
	"log"

	jwt_tool "github.com/yingshaoxo/gopython/jwt_tool"
)

func main() {
	secret := "no way"

	data := make(map[string]interface{})
	data["user"] = "yingshaoxo"

	jwt_string := jwt_tool.Jwt_encode(data, secret)
	log.Println(jwt_string)

	new_data, _ := jwt_tool.Jwt_decode(jwt_string, secret)

	log.Println(data)
	log.Println(new_data)
}
Network
package main

import (
	"log"

	port_scanner "github.com/yingshaoxo/gopython/network"
)

func main() {
	urls := port_scanner.ScanPorts("localhost", 0, 65535)
	log.Println(urls)
}

Directories

Path Synopsis
We implement python built-in functions here
We implement python built-in functions here
We use this package to handle databases
We use this package to handle databases
We handle dictionary/map/key-value related problems here
We handle dictionary/map/key-value related problems here
We do disk(storage) related work here
We do disk(storage) related work here
We handle error related work here
We handle error related work here
We handle function related work here
We handle function related work here
We do json operations here
We do json operations here
We handle json web token related problems here
We handle json web token related problems here
We handle list/array related problems here
We handle list/array related problems here
We use this package to do port scanning for a host or many hosts
We use this package to do port scanning for a host or many hosts
We handle network related problems here
We handle network related problems here
internal command
made by baidu ai
made by baidu ai
We do safe math here, for example, handle big numbers for financial problems
We do safe math here, for example, handle big numbers for financial problems
We handle string related problems here
We handle string related problems here
We handle terminal/bash/shell problems here
We handle terminal/bash/shell problems here
We handle time related problems here
We handle time related problems here
We handle variable related problems here, for example, is the variable nullable
We handle variable related problems here, for example, is the variable nullable

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL