-4

When I use "Step Into" in the debugger, it jumps into functions/types from outside my project (stdlib, vendor, etc.). How can I configure the debugger to step only into my own code? That's my code.

    
        package main
    
        import (
        "encoding/json"
        "fmt"
        "os"
        )
    
        var cmdAdd string
        var surname string
    
        type Task struct {
        ID     string `json:"id"`
        Name   string `json:"name"`
        Status string `json:"status"`
        }
    
        func main() {
        fileTaskTracker := "tasks.json"
        if len(os.Args) < 2 {
            fmt.Println("Please provide a command add, update or delete")
            return
        }
        tasks := []Task{}
    
        // Marshal the struct to JSON
        jsonData, err := json.MarshalIndent(tasks, "", "  ") // Use MarshalIndent for pretty-printing
        if err != nil {
            fmt.Println("Error marshalling JSON:", err)
            return
        }
        err = os.WriteFile(fileTaskTracker, jsonData, 0644) // 0644 sets file permissions
        if err != nil {
            fmt.Printf("Error writing to file: %v\n", err)
            return
        }
        fmt.Println(jsonData)
        }

I set break point on line:

    jsonData, err := json.MarshalIndent(tasks, "", "  ") // Use MarshalIndent for pretty-printing
2
  • Please provide enough code so others can better understand or reproduce the problem. Commented Nov 18 at 12:27
  • 1
    If you are giving the command to step into a function, what else do you expect the debugger to do other than step into that function? That’s why there is also a “step over” Commented Nov 18 at 14:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.