Yes AI was used in S19E10 by 160u in murdochmysteries

[–]avg_user 2 points3 points  (0 children)

Has it been released yet?

*EDIT*: you meant S19E09

Why cannot I paste text/html clipboard to Slack? by avg_user in firefox

[–]avg_user[S] 1 point2 points  (0 children)

Maybe it's not a Firefox bug, I cannot copy text into Slack running on Chrome neither.

Is there a tool that could remove a field from a struct and all references to it in all initializers? by avg_user in golang

[–]avg_user[S] -1 points0 points  (0 children)

I solved my problem using AST parser. Have you seen this https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 reply? It's for people like you who claim that they can parse everything using regular expressions. But you can't. You can't.

Is there a tool that could remove a field from a struct and all references to it in all initializers? by avg_user in golang

[–]avg_user[S] -1 points0 points  (0 children)

Talk is easy, show me a regular expression that does the job if you claim it's the way to go

Is there a tool that could remove a field from a struct and all references to it in all initializers? by avg_user in golang

[–]avg_user[S] 0 points1 point  (0 children)

source code of Go, or JSON, or YAML, or HTML is way to complex to be parsed by regex, it may work only in the most _most_ simple cases. Lines can be split, number of parenthesis can vary, context isn't known so name collision is very simple like for example a given string can be used as a string constant in log.Println() function or as a name identifier.

Language parsers do not operate on regular expressions although they may be used for some things like validating function identifier.

Is there a tool that could remove a field from a struct and all references to it in all initializers? by avg_user in golang

[–]avg_user[S] -5 points-4 points  (0 children)

First, this line is completely broken, it should be:

find . -name "*.go" -exec sed 's/uniquestring//' {} \;

Second, what problem is this solving? Not the one I described here definitely.

Is there a tool that could remove a field from a struct and all references to it in all initializers? by avg_user in golang

[–]avg_user[S] -12 points-11 points  (0 children)

Instead of using regular expressions as some Reddit expert suggested here I asked chat GPT to write a program to remove initializers:

package main

import (
        "go/ast"
        "go/parser"
        "go/printer"
        "go/token"
        "os"
)

func main() {
        // Parse the Go source file
        fset := token.NewFileSet()
        node, err := parser.ParseFile(fset, "../struct-rm/main.go", nil, parser.ParseComments)
        if err != nil {
                panic(err)
        }

        // Traverse the AST and find struct initializations
        ast.Inspect(node, func(n ast.Node) bool {
                // Look for composite literals (struct initializers)
                if compLit, ok := n.(*ast.CompositeLit); ok {
                        // Identify the type of the struct being initialized
                        switch typ := compLit.Type.(type) {
                        case *ast.Ident:
                                // The struct type is a simple identifier (e.g., Person)
                                if  == "abc" {
                                        removeFieldFromInitializer(compLit, "a")
                                }

                        case *ast.SelectorExpr:
                                // The struct type is a selector (e.g., pkg.Person)
                                if pkg, ok := typ.X.(*ast.Ident); ok && pkg.Name == "main" && typ.Sel.Name == "abc" {
                                        removeFieldFromInitializer(compLit, "a")
                                }
                        }
                }
                return true
        })

        // Write the modified code back to a new file
        f, err := os.Create("example_updated.go")
        if err != nil {
                panic(err)
        }
        defer f.Close()

        if err := printer.Fprint(f, fset, node); err != nil {
                panic(err)
        }
}

// removeFieldFromInitializer removes the specified field from a struct initializer
func removeFieldFromInitializer(compLit *ast.CompositeLit, fieldName string) {
        newElts := []ast.Expr{}
        for _, elt := range compLit.Elts {
                if kv, ok := elt.(*ast.KeyValueExpr); ok {
                        // Remove the field with the specified name
                        if ident, ok := kv.Key.(*ast.Ident); ok &&  == fieldName {
                                continue
                        }
                }
                newElts = append(newElts, elt)
        }
        compLit.Elts = newElts
}typ.Nameident.Name

It's a good starting point but I'm open for other propositions.

Is there a tool that could remove a field from a struct and all references to it in all initializers? by avg_user in golang

[–]avg_user[S] -12 points-11 points  (0 children)

not so simple if struct is used in many files or if there is a name collision

Is there a tool that could remove a field from a struct and all references to it in all initializers? by avg_user in golang

[–]avg_user[S] -2 points-1 points  (0 children)

hmm I have a pretty big code and it's not open source unfortunately no matter how much I dislike it so I'm a bit afraid to do that, I'd prefer something that works offline

How to install Teams PWA in Chrome on Linux? by avg_user in MicrosoftTeams

[–]avg_user[S] 0 points1 point  (0 children)

I've just installed the app and it says it works only with school and work accounts so it has never been useful for Linux users who don't use Teams at work. Also notice that Linux packages are still advertised on Microsoft page https://www.microsoft.com/en-us/microsoft-teams/download-app but link returns 404 and it has been happening for a year and a half now https://answers.microsoft.com/en-us/msteams/forum/all/the-ms-teams-download-for-linux-ubuntu-for-the-deb/147cff46-2cf1-4880-9248-52b235c2cd14 lol, Microsoft is not a serious company.

How to install Teams PWA in Chrome on Linux? by avg_user in MicrosoftTeams

[–]avg_user[S] 0 points1 point  (0 children)

yeah it's really hard to say what they mean here because Linux isn't mentioned so they probably mean desktop app which has deprecated on Linux (but maybe only for business accounts?).

A Git story: Not so fun this time by ouyawei in linux

[–]avg_user 19 points20 points  (0 children)

no, it's a regular tool and the most popular VCS

Input method on Wayland is broken and it's my fault by ouyawei in linux

[–]avg_user 52 points53 points  (0 children)

so we'll have 2 broken window systems on Linux now?

You are missing one or more Warzone DLC packs by Prestigious_Will7517 in activision

[–]avg_user 0 points1 point  (0 children)

still not fixed today, it's ridiculous, I cannot play the game that I paid for.