The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
lilei2023

小小的吐槽一下 go, filepath.Glob 这个函数竟然 不支持 两个星号(**)

  •  
  •   lilei2023 · Dec 20, 2023 · 1906 views
    This topic created in 900 days ago, the information mentioned may be changed or developed.

    ChatGPT 给的都是错误的结果

    感觉这种功能比较基础啊,大佬们怎么没有实现呢,前端的构建工具基本上都支持这个语法!

    别问为什么吐槽(小菜不会写)

    7 replies    2023-12-20 15:13:18 +08:00
    lilei2023
        1
    lilei2023  
    OP
       Dec 20, 2023
    还有一个 template.ParseFiles ,不同子目录下文件同名也不行!额,搞不懂
    Hieast
        2
    Hieast  
       Dec 20, 2023
    go 跟前端的关系是?
    bv
        3
    bv  
       Dec 20, 2023
    应该是 Go 文件通配设计就是如此,可以参考: https://pkg.go.dev/path/filepath#Match

    不过在 Java 中确实会有 ** 这种通配写法
    lilei2023
        4
    lilei2023  
    OP
       Dec 20, 2023
    @Hieast 哈哈,没关系,我是前端,发现 go 不能 使用 ** 很难受
    lilei2023
        5
    lilei2023  
    OP
       Dec 20, 2023
    @bv 嗯,只是好奇 大佬们为何这样设计!我觉得这个平时应该经常用到。
    bv
        6
    bv  
       Dec 20, 2023
    至于为什么这样设计,看看这个 issue 有没有你想要的答案 https://github.com/golang/go/issues/11862
    lilei2023
        7
    lilei2023  
    OP
       Dec 20, 2023
    @bv 感谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2831 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 09:02 · PVG 17:02 · LAX 02:02 · JFK 05:02
    ♥ Do have faith in what you're doing.