package main
import (
"fmt"
"os/exec"
"strings"
)
func main() {
// Step 1: Get user input for the search query
fmt.Print("Enter your Google search query: ")
var query string
fmt.Scanln(&query)
// Step 2: Prepare the search query for the Google search URL
searchURL := "https://www.google.com/search?q=" + strings.ReplaceAll(query, " ", "+")
// Step 3: Open the default web browser with the Google search URL
cmd := exec.Command("xdg-open", searchURL) // Adjust the command based on the operating system
err := cmd.Run()
// Step 4: Check for errors in opening the web browser
if err != nil {
fmt.Println("Error opening web browser:", err)
}
}