func isShubh(now time.Time) bool {
  chowgadhiya := getChowgadhiya(now)
  return isChowgadhiyaConsideredShubh(chowgadhiya)
}
returns whether now is an auspicious time or not
package main
import (
  "fmt"
  "github.com/kelvins/sunrisesunset"
  "io/ioutil"
  "log"
  "math"
  "os"
  "os/exec"
  "strconv"
  "time"
)
type Chowgadhiya int
type Phase int
const (
  Day Phase = iota
  Night
)
const (
  Chal Chowgadhiya = iota
  Amrit
  Kaal
  Labh
  Rog
  Shubh
  Udveg
)
const DEFAULT_LATITUDE  string = "26.7880"
const DEFAULT_LONGITUDE string = "82.1986"
var CHOWGADHIYA_LIST = map[Phase]map[time.Weekday][]Chowgadhiya{
  Day: map[time.Weekday][]Chowgadhiya{
    time.Sunday:    []Chowgadhiya{Udveg, Chal, Labh, Amrit, Kaal, Shubh, Rog, Udveg},
    time.Monday:    []Chowgadhiya{Amrit, Kaal, Shubh, Rog, Udveg, Chal, Labh, Amrit},
    time.Tuesday:   []Chowgadhiya{Rog, Udveg, Chal, Labh, Amrit, Kaal, Shubh, Rog},
    time.Wednesday: []Chowgadhiya{Labh, Amrit, Kaal, Shubh, Rog, Udveg, Chal, Labh},
    time.Thursday:  []Chowgadhiya{Shubh, Rog, Udveg, Chal, Labh, Amrit, Kaal, Shubh},
    time.Friday:    []Chowgadhiya{Chal, Labh, Amrit, Kaal, Shubh, Rog, Udveg, Chal},
    time.Saturday:  []Chowgadhiya{Kaal, Shubh, Rog, Udveg, Chal, Labh, Amrit, Kaal},
  },
  Night: map[time.Weekday][]Chowgadhiya{
    time.Sunday:    []Chowgadhiya{Shubh, Amrit, Chal, Rog, Kaal, Labh, Udveg, Shubh},
    time.Monday:    []Chowgadhiya{Chal, Rog, Kaal, Labh, Udveg, Shubh, Amrit, Chal},
    time.Tuesday:   []Chowgadhiya{Kaal, Labh, Udveg, Shubh, Amrit, Chal, Rog, Kaal},
    time.Wednesday: []Chowgadhiya{Udveg, Shubh, Amrit, Chal, Rog, Kaal, Labh, Udveg},
    time.Thursday:  []Chowgadhiya{Amrit, Chal, Rog, Kaal, Labh, Udveg, Shubh, Amrit},
    time.Friday:    []Chowgadhiya{Rog, Kaal, Labh, Udveg, Shubh, Amrit, Chal, Rog},
    time.Saturday:  []Chowgadhiya{Labh, Udveg, Shubh, Amrit, Chal, Rog, Kaal, Labh},
  },
}
func isChowgadhiyaConsideredShubh(c Chowgadhiya) bool {
  debug("Picked Chowgadhiya", c)
  return (c == Amrit || c == Shubh || c == Labh)
}
func getChowgadhiyaListFromWeekday(day time.Weekday, phase Phase) []Chowgadhiya {
  return CHOWGADHIYA_LIST[phase][day]
}
func getChowgadhiya(t time.Time) Chowgadhiya {
  sunrise, sunset, nextSunrise := getVedicDay(t)
  debug("Next sunrise:", nextSunrise)
  debug("Current time:", t)
  if t.Before(sunrise) || t.After(nextSunrise) {
    panic("current time does not fall between Sunrise and Sunset")
  }
  var baseTime time.Time
  var phase Phase
  var offsetInSeconds float64
  if t.Before(sunset) {
    phase = Day
    baseTime = sunrise
    offsetInSeconds = (sunset.Sub(sunrise) / 8).Seconds()
  } else {
    phase = Night
    baseTime = sunset
    offsetInSeconds = (nextSunrise.Sub(sunset) / 8).Seconds()
    debug("time difference:", nextSunrise.Sub(t).Hours())
  }
  timePassedInCurrentPhase := t.Sub(baseTime).Seconds()
  debug("timePassedInCurrentPhase:", timePassedInCurrentPhase)
  debug("offsetInSeconds:", offsetInSeconds)
  numberOfChowgadhiyaPassed := timePassedInCurrentPhase / offsetInSeconds
  debug("numberOfChowgadhiyaPassed:", numberOfChowgadhiyaPassed)
  chowgadhiyaIndex := int(math.Floor(numberOfChowgadhiyaPassed))
  debug("chowgadhiyaIndex:", chowgadhiyaIndex)
  list := getChowgadhiyaListFromWeekday(sunrise.Weekday(), phase)
  debug("phase:", phase)
  debug("list:", list)
  return list[chowgadhiyaIndex]
}
func getEnv(key, fallback string) string {
  if value, ok := os.LookupEnv(key); ok {
    return value
  }
  return fallback
}
func getSunriseSunset(t time.Time) (time.Time, time.Time) {
  reference_time := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, time.UTC)
  _, offset := t.Zone()
  fractional_offset := (float64(offset) / 60 / 60)
  if fractional_offset > 12 {
    fractional_offset = 12 - fractional_offset
  }
  latitude, _  := strconv.ParseFloat(getEnv("LATITUDE", DEFAULT_LATITUDE), 64)
  longitude, _ := strconv.ParseFloat(getEnv("LONGITUDE", DEFAULT_LONGITUDE), 64)
  p := sunrisesunset.Parameters{
    Latitude:  latitude,
    Longitude: longitude,
    UtcOffset: fractional_offset,
    Date:      reference_time,
  }
  sunrise, sunset, err := p.GetSunriseSunset()
  if err == nil {
    return sunrise, sunset
  }
  panic("sunrise/sunset calculations failed")
}