V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
hahadaxigua834
V2EX  ›  问与答

怎么写出让人无法理解且恶心的 go 代码

  •  
  •   hahadaxigua834 · Dec 30, 2022 · 1673 views
    This topic created in 1220 days ago, the information mentioned may be changed or developed.

    尝试了一下打印 1 到 10 ,不够恶心而且还是能看懂 https://go.dev/play/p/blIc9lco6HA

    package main
    
    type float = func() int
    
    var nil = []float{}
    
    func main() {
    	i := 10
    	for ; ; i-- {
    		if i == 0 {
    			goto x
    		}
    		i := i
    		f := new(float)
    		*f = func() int {
    			return i
    		}
    		nil = append(nil, *f)
    	}
    x:
    	hh(nil)
    }
    func hh[T float](x []T) {
    	for _, e := range x {
    		defer println(e())
    	}
    }
    
    3 replies    2022-12-31 10:36:07 +08:00
    EscYezi
        1
    EscYezi  
       Dec 31, 2022 via iPhone
    你可能需要代码混淆🤣
    netabare
        2
    netabare  
       Dec 31, 2022   ❤️ 1
    把变量名改为`_0`之类的?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   979 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 23:41 · PVG 07:41 · LAX 16:41 · JFK 19:41
    ♥ Do have faith in what you're doing.