Go time library inspired by Moment.js

Go

Goment

Current Version: 1.4.0
Changelog

Goment is a port of the popular Javascript datetime library Moment.js. It follows the Moment.js API closely, with some changes to make it more Go-like (e.g. using nanoseconds instead of milliseconds).

Goment is still a work in progress. Please feel free to fork and contribute missing methods, locale/languages functionality, or just provide more idiomatic Go if you see some areas to improve. I have a list of things that need added/fixed in TODO.md, but will create issues for them at some point.

Features

Parsing

From now

Creates a Goment object for the current local time returned by time.Now().

goment.New()

From ISO 8601 string

Creates a Goment object by parsing the string as an ISO 8601 date time. The timezone will be UTC unless supplied in the string.

goment.New('2013-02-08 09:30:26')

From string + format

Creates a Goment object by parsing the string using the supplied format. The timezone will be the local timezone unless supplied in the string.

The parsing tokens are similar to the formatting tokens used in Goment#Format.

Goment's parser is strict, and defaults to being accurate over forgiving.

Year, month, and day tokens
Token Output
Month M 1 2 ... 11 12
MM 01 01 ... 11 12
MMM Jan Feb ... Nov Dec
MMMM January February ... November December
Day of Month D 1 2 ... 30 31
Do 1st 2nd ... 30th 31st
DD 01 02 ... 30 31
Day of Year DDD 1 2 ... 364 365
DDDD 001 002 ... 364 365
Year YY 70 71 ... 29 30
YYYY 1970 1971 ... 2029 2030
Y -25
Quarter Q 1 2 3 4
Unix Timestamp X 1360013296
goment.New("12-25-1995", "MM-DD-YYYY")
Hour, minute, second, and offset tokens
Token Output
AM/PM A AM PM
a am pm
Hour H 0 1 ... 22 23
HH 00 01 ... 22 23
h 1 2 ... 11 12
hh 01 02 ... 11 12
k 1 2 ... 23 24
kk 01 02 ... 23 24
Minute m 0 1 ... 58 59
mm 00 01 ... 58 59
Second s 0 1 ... 58 59
ss 00 01 ... 58 59
Time Zone Z -07:00 -06:00 ... +06:00 +07:00
ZZ -0700 -0600 ... +0600 +0700
Week year, week, and weekday tokens

For these, the lowercase tokens use the locale aware week start days, and the uppercase tokens use the ISO week date start days.

Token Output
Locale 4 digit week year gggg 2014
Locale 2 digit week year gg 14
Locale week of year w ww 1..53
Locale day of week e 0..6
Day name in locale set by Goment.SetLocale() dd ddd dddd Mo..Mon..Sunday
ISO 4 digit week year GGGG 2014
ISO 2 digit week year GG 14
ISO week of year W WW 1..53
ISO day of week E 1..7

From string + format + locale

As of Goment 1.2.0, a locale can now be supplied to parse locale-specific dates and times.

Locale-aware formats
Token Output
Time LT 8:30 PM
Time with seconds LTS 8:30:25 PM
Month numeral, day of month, year L 09/04/1986
l 9/4/1986
Month name, day of month, year LL September 4, 1986
ll Sep 4, 1986
Month name, day of month, year, time LLL September 4, 1986 8:30 PM
lll Sep 4, 1986 8:30 PM
Month name, day of month, day of week, year, time LLLL Thursday, September 4, 1986 8:30 PM
llll Thu, Sep 4, 1986 8:30 PM
goment.New("2 de septiembre de 1999 12:30", "LLL", "es")

From Unix nanoseconds

Creates a Goment object from the Unix nanoseconds since the Unix Epoch.

goment.New(time.Now().UnixNano())

From Unix seconds

Creates a Goment object from the Unix timestamp (seconds since the Unix Epoch).

goment.Unix(1318781876)

From Go Time object

Creates a Goment object from the supplied Go time object.

goment.New(time.Date(2015, 11, 10, 5, 30, 0, 0, time.UTC))

From a Goment clone

Creates a Goment object from a clone of the supplied Goment object.

goment.New(goment.New('2011-05-08'))

From Goment DateTime object

Creates a Goment object from a Goment DateTime object.

goment.New(DateTime{
    Year:  2015,
    Month: 1,
    Day:   25,
    Hour:  10,
})

Get+Set

Get

Get is a string getter using the supplied units.

Supported units
  • y, year, years
  • M, month, months
  • D, date, dates
  • h, hour, hours
  • m, minute, minutes
  • s, second, seconds
  • ms, millisecond, milliseconds
  • ns, nanosecond, nanoseconds
g.Get('hours') // 22

Nanosecond

Gets the nanoseconds of the Goment object.

g.Nanosecond() // 600

Millisecond

Gets the milliseconds of the Goment object.

g.Millisecond() // 330

Second

Gets the seconds of the Goment object.

g.Second() // 33

Minute

Gets the minutes of the Goment object.

g.Minute() // 45

Hour

Gets the hours of the Goment object.

g.Hour() // 22

Day of Month

Gets the day of the month of the Goment object.

g.Date() // 19

Day of Week

Gets the day of the week (Sunday = 0...) of the Goment object.

g.Day() // 2

Day of Week (Locale Aware)

Gets the day of the week according to the locale of the Goment object.

g.Weekday() // 3

ISO Day of Week

Gets the Goment object ISO day of the week with 1 being Monday and 7 being Sunday.

g.ISOWeekday() // 4

Day of Year

Gets the day of the year of the Goment object.

g.DayOfYear() // 100

Week of Year

Gets the localized week of the year for the Goment object.

The week of the year varies depending on which day is the first day of the week (Sunday, Monday, etc), and which week is the first week of the year.

For example, in the United States, Sunday is the first day of the week. The week with January 1st in it is the first week of the year.

In France, Monday is the first day of the week, and the week with January 4th is the first week of the year.

The output of g.Week() will depend on the locale for the Goment object.

g.Week() // 52

Week of Year (ISO)

Gets the ISO week of the year of the Goment object.

g.ISOWeek() // 6

Month

Gets the month (January = 1...) of the Goment object.

g.Month() // 2

Quarter

Gets the quarter (1 to 4) of the Goment object.

g.Quarter() // 1

Year

Gets the year of the Goment object.

g.Year() // 2013

Week Year

Gets the week-year according to the Goment object's locale.

Because the first day of the first week does not always fall on the first day of the year, sometimes the week-year will differ from the month year.

For example, in the US, the week that contains Jan 1 is always the first week. In the US, weeks also start on Sunday. If Jan 1 was a Monday, Dec 31 would belong to the same week as Jan 1, and thus the same week-year as Jan 1. Dec 30 would have a different week-year than Dec 31.

g.WeekYear() // 2012

Week Year (ISO)

Gets the ISO week-year of the Goment object.

g.ISOWeekYear() // 2013

Weeks In Year

Gets the number of weeks according to locale in the current Goment's year.

g.WeekYear() // 53

Weeks In Year (ISO)

Gets the number of weeks in the current Goment's year, according to ISO weeks.

g.ISOWeeksInYear() // 52

Set

Set is a generic setter, accepting units as the first argument, and value as the second.

Supported units
  • y, year, years
  • M, month, months
  • D, date, dates
  • h, hour, hours
  • m, minute, minutes
  • s, second, seconds
  • ms, millisecond, milliseconds
  • ns, nanosecond, nanoseconds
g.Set(6, 'hour')

Set Nanosecond

Sets the nanoseconds for the Goment object.

g.SetNanosecond(60000)

Set Millisecond

Sets the milliseconds for the Goment object.

g.SetMillisecond(5000)

Set Second

Sets the seconds for the Goment object.

g.SetSecond(55)

Set Minute

Sets the minutes for the Goment object.

g.SetMinute(15)

Set Hour

Sets the hours for the Goment object.

g.SetHour(5)

Set Day of Month

Sets the day of the month for the Goment object. If the date passed in is greater than the number of days in the month, then the day is set to the last day of the month.

g.SetDate(21)

Set Day of Week

Sets the day of the week (Sunday = 0...) for the Goment object.

g.SetDay(1)

As of 1.3.0, a day name is also supported. This is parsed in the Goment object's locale.

g.SetDay("lunes")

Set Day of Week (Locale Aware)

Sets the day of the week according to the locale of the Goment object.

If the locale assigns Monday as the first day of the week, g.SetWeekday(0) will be Monday. If Sunday is the first day of the week, g.SetWeekday(0) will be Sunday.

g.SetWeekday(0)

Set Day of Week (ISO)

Sets the Goment object ISO day of the week with 1 being Monday and 7 being Sunday.

g.SetISOWeekday(2)

Set Day of Year

Sets the day of the year for the Goment object. For non-leap years, 366 is treated as 365.

g.SetDayOfYear(100)

Set Week of Year

Sets the localized week of the year for the Goment object. When setting the week of the year, the day of the week is retained.

get.SetWeek(50)

Set Week of Year (ISO)

Sets the ISO week of the year for the Goment object.

When setting the week of the year, the day of the week is retained.

g.SetISOWeek(52)

Set Month

Sets the month (January = 1...) of the Goment object. If new month has less days than current month, the date is pinned to the end of the target month.

g.SetMonth(3)

Set Quarter

Sets the quarter (1 to 4) for the Goment object.

g.SetQuarter(2)

Set Year

Sets the year for the Goment object.

g.SetYear(2010)

Set Week Year

Sets the week-year according to the Goment object's locale.

g.SetWeekYear(2014)

Set Week Year (ISO)

Sets the ISO week-year of the Goment object.

g.SetISOWeekYear(2018)

Manipulate

Add

Add mutates the Goment object by adding time. The first argument can either be a time.Duration, or an integer representing the number of the unit to add. The second argument should be a unit.

Supported units
  • y, year, years
  • Q, quarter, quarters
  • M, month, months
  • w, week, weeks
  • d, day, days
  • h, hour, hours
  • m, minute, minutes
  • s, second, seconds
  • ms, millisecond, milliseconds
  • ns, nanosecond, nanoseconds
g.Add(1, 'days')

Subtract

Subtract mutates the Goment object by subtracting time. The first argument can either be a time.Duration, or an integer representing the number of the unit to add. The second argument should be a unit.

Supported units
  • y, year, years
  • Q, quarter, quarters
  • M, month, months
  • w, week, weeks
  • d, day, days
  • h, hour, hours
  • m, minute, minutes
  • s, second, seconds
  • ms, millisecond, milliseconds
  • ns, nanosecond, nanoseconds
g.Subtract(5, 'hours')

StartOf

StartOf mutates the Goment object by setting it to the start of a unit of time.

Supported units
  • y, year, years
  • Q, quarter, quarters
  • M, month, months
  • w, week, weeks
  • W, isoWeek, isoWeeks
  • d, day, days
  • h, hour, hours
  • m, minute, minutes
  • s, second, seconds
g.StartOf('day')

EndOf

EndOf mutates the Goment object by setting it to the end of a unit of time.

Supported units
  • y, year, years
  • Q, quarter, quarters
  • M, month, months
  • w, week, weeks
  • W, isoWeek, isoWeeks
  • d, day, days
  • h, hour, hours
  • m, minute, minutes
  • s, second, seconds
g.EndOf('month')

Local

Local will set the Goment to use local time.

g.Local()

UTC

UTC will set the Goment to use UTC time.

g.UTC()

UTCOffset

UTCOffset gets the Goment's UTC offset in minutes.

g.UTCOffset() // -6

SetUTCOffset

SetUTCOffset sets the Goment's UTC offset in minutes. If the offset is less than 16 and greater than -16, the value is treated as hours.

g.SetUTCOffset(120)

Display

Format

Format takes a string of tokens and replaces them with their corresponding values to display the Goment.

Supported tokens
Token Output
Month M 1 2 ... 11 12
Mo 1st 2nd ... 11th 12th
MM 01 01 ... 11 12
MMM Jan Feb ... Nov Dec
MMMM January February ... November December
Quarter Q 1 2 3 4
Day of Month D 1 2 ... 30 31
Do 1st 2nd ... 30th 31st
DD 01 02 ... 30 31
Day of Year DDD 1 2 ... 364 365
DDDo 1st 2nd ... 364th 365th
DDDD 001 002 ... 364 365
Day of Week d 0 1 ... 5 6
do 0th 1st ... 5th 6th
dd Su Mo ... Fr Sa
ddd Sun Mon ... Fri Sat
dddd Sunday Monday ... Friday Saturday
Day of Week (Locale) e 0 1 ... 5 6
Day of Week (ISO) E 1 2 ... 6 7
Week of Year w 1 2 ... 52 53
wo 1st 2nd ... 52nd 53rd
ww 01 02 ... 52 53
Week of Year (ISO) W 1 2 ... 52 53
Wo 1st 2nd ... 52nd 53rd
WW 01 02 ... 52 53
Year YY 70 71 ... 29 30
YYYYYY -001970 -001971 ... +001970 +001971
YYYYY 01970 01971 ... 02010 02100
YYYY 1970 1971 ... 2029 2030
Y 1970 1971 ... 9999 +10000 +10001
Week Year gg 70 71 ... 29 30
gggg 1970 1971 ... 2029 2030
Week Year (ISO) GG 70 71 ... 29 30
GGGG 1970 1971 ... 2029 2030
AM/PM A AM PM
a am pm
Hour H 0 1 ... 22 23
HH 00 01 ... 22 23
h 1 2 ... 11 12
hh 01 02 ... 11 12
k 1 2 ... 23 24
kk 01 02 ... 23 24
Minute m 0 1 ... 58 59
mm 00 01 ... 58 59
Second s 0 1 ... 58 59
ss 00 01 ... 58 59
Time Zone z or zz EST CST ... MST PST
zzzz Eastern Standard Time
Z -07:00 -06:00 ... +06:00 +07:00
ZZ -0700 -0600 ... +0600 +0700
Unix Timestamp X 1360013296
Unix Millisecond Timestamp x 1360013296123
Time LT 8:30 PM
Time with seconds LTS 8:30:25 PM
Month numeral, day of month, year L 09/04/1986
l 9/4/1986
Month name, day of month, year LL September 4, 1986
ll Sep 4, 1986
Month name, day of month, year, time LLL September 4, 1986 8:30 PM
lll Sep 4, 1986 8:30 PM
Month name, day of month, day of week, year, time LLLL Thursday, September 4, 1986 8:30 PM
llll Thu, Sep 4, 1986 8:30 PM
g.Format('YYYY-MM-DD') // 2020-05-01

FromNow

FromNow returns the relative time from now to the Goment time.

g.FromNow() // 10 months ago

ToNow

ToNow returns the relative time to now to the Goment time.

g.ToNow() // minutes

From

From returns the relative time from the supplied time to the Goment time.

g.From(goment.New()) // a day ago

To

To returns the relative time from the Goment time to the supplied time.

g.To(goment.New()) // in a minute

Calendar

Calendar displays time relative to a given referenceTime (defaults to now).

g.Calendar() // Today at 1:00 PM

Difference

Diff returns the difference between two Goments as an integer.

g.Diff(goment.New(), 'years') // 3

ToUnix

ToUnix returns the Unix timestamp (the number of seconds since the Unix Epoch).

g.ToUnix() // 1360310950

DaysInMonth

DaysInMonth returns the number of days in the set month.

g.DaysInMonth() // 28

ToTime

ToTime returns the time.Time object that is wrapped by Goment.

g.ToTime()

ToArray

ToArray returns an array that mirrors the parameters from time.Date().

g.ToArray() // [2013 2 8 8 9 10 0]

ToDateTime

ToDateTime returns a Goment.DateTime struct.

g.ToDateTime() // {2013 2 8 8 9 10 0 UTC}

ToString

ToString returns an English string representation of the Goment time.

g.ToString() // 2006-01-02 15:04:05.999999999 -0700 MST

ToISOString

ToISOString returns a ISO8601 standard representation of the Goment time.

g.ToISOString() // 2016-04-12T19:46:47.286Z

Query

IsBefore

IsBefore will check if a Goment is before another Goment.

g.IsBefore(goment.New()) // true

IsAfter

IsAfter will check if a Goment is after another Goment.

g.IsAfter(goment.New()) // false

IsSame

IsSame will check if a Goment is the same as another Goment.

g.IsSame(goment.New()) // true

IsSameOrBefore

IsSameOrBefore will check if a Goment is before or the same as another Goment.

g.IsSameOrBefore(goment.New()) // true

IsSameOrAfter

IsSameOrAfter will check if a Goment is after or the same as another Goment.

g.IsSameOrAfter(goment.New()) // false

IsBetween

IsBetween will check if a Goment is between two other Goments.

g.IsBetween(goment.New(), goment.New().Add(5, 'days)) // true

IsDST

IsDST checks if the Goment is in daylight saving time.

g.IsDST() // true

IsLeapYear

IsLeapYear returns true if the Goment's year is a leap year, and false if it is not.

g.IsLeapYear() // false

IsTime

IsTime will check if a variable is a time.Time object.

g.IsTime(time.Now()) // true

IsGoment

IsGoment will check if a variable is a Goment object.

g.IsGoment(goment.New()) // true

i18n

Goment has support for internationalization.

In addition to assigning a global locale, you can assign a locale to a specific Goment object.

* Currently, only formatting functions like Format, To, From, ToNow, FromNow & Calendar use locales. Only English (United States) datetime formats are able to be parsed at this time.

Changing global locale

By default, Goment uses English (United States) locale strings. Changing the global locale does not affect existing Goment instances.

SetLocale("es")

Getting global locale

Locale() // es

Changing locale for Goment instance

g.SetLocale("fr")

Getting locale for Goment instance

g.Locale() // fr

Weekdays

Returns a list of weekdays in the current locale. If the parameter provided is a bool value of true, the list returned will take the current locale's first day of week into consideration. If no true parameter is provided, the first day will always be Sunday for the locale.

g.SetLocale("en")
g.Weekdays() // [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ]

g.SetLocale("es")
g.Weekdays(true) // ["lunes", "martes", "miércoles", "jueves", "viernes", "sábado", "domingo"]
g.Weekdays() // ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"]

WeekdaysShort

Returns a list of abbreviated weekdays in the current locale. If the parameter provided is a bool value of true, the list returned will take the current locale's first day of week into consideration. If no true parameter is provided, the first day will always be Sunday for the locale.

g.SetLocale("en")
g.WeekdaysShort() // [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ]

g.SetLocale("es")
g.WeekdaysShort(true) // ["lun.", "mar.", "mié.", "jue.", "vie.", "sáb.", "dom."]
g.WeedaysShort() // ["dom.", "lun.", "mar.", "mié.", "jue.", "vie.", "sáb."]

WeekdaysMin

Returns a list of abbreviated weekdays in the current locale. If the parameter provided is a bool value of true, the list returned will take the current locale's first day of week into consideration. If no true parameter is provided, the first day will always be Sunday for the locale.

g.SetLocale("en")
g.WeekdaysMin() // [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ]

g.SetLocale("es")
g.WeekdaysMin(true) // ["lu", "ma", "mi", "ju", "vi", "sá", "do"]
g.WeedaysMin() // ["do", "lu", "ma", "mi", "ju", "vi", "sá"]

WeekdayByNumber

Returns the weekday name by number in the current locale. If the first parameter is a bool value of true, the name returned will take the current locale's first day of week into consideration. If no true parameter is provided, the first day will always be Sunday for the locale.

g.SetLocale("en")
g.WeekdayByNumber(0) // "Sunday"
g.WeekdayByNumber(true, 0) // "Sunday"

g.SetLocale("es")
g.WeekdayByNumber(0) // "domingo"
g.WeekdayByNumber(true, 0) // "lunes"

Months

Returns a list of months in the current locale.

g.Months() // [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]

MonthByNumber

Returns the month name by number in the current locale.

g.MonthByNumber(1) // "January"

MonthsShort

Returns a list of abbreviated month names in the current locale.

g.MonthsShort() // [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ]

MonthShortByNumber

Returns the abbreviated month name by number in the current locale.

g.MonthShortByNumber(2) // "Feb"

Adding a new locale

To add a new locale, there are a few steps to follow. You must first add a new file in the /locales folder. This should be named the locale code, e.g. fr.go. Inside this file, you need to create a new LocaleDetails object and provide the required values for month names, weekday names, ordinal function, etc. Please use one of the existing locales for reference.

After you've created the locale file, add a line to locale.go in the supportedLocales map. This should be a map from the locale code to an instance of the LocaleDetails object you created above.

Lastly, please add test cases to locale_test.go that test the different datetime formats, and the relative time formats.

Owner
Nick Leeper
Director of Engineering at @Dwolla. Formerly Lead Engineer of Finance/Fundraising at OFA. Currently interested in payments, Golang and home automation.
Nick Leeper
Comments
  • go get -v github.com/nleeper/goment error

    go get -v github.com/nleeper/goment error

    Tried doing go get -v github.com/nleeper/goment

    Expected Behaviour

    Install successfully

    Error

    ../../pkg/mod/github.com/nleeper/[email protected]/goment.go:7:2: module github.com/nleeper/goment@latest found (v1.0.8), but does not contain package github.com/nleeper/goment/internal/locales

  • Format() does not support both long and abbreviated form of time zone

    Format() does not support both long and abbreviated form of time zone

    I was usingFormat to print the time zone information. I was expecting the abbreviated form but got the long form. I tried both "z" and "zz" with the same result.

    What was done:

    g, _ := goment.Unix(time.Now().Unix())
    fmt.Println(g.Format("zz"))
    fmt.Println(g.Format("z"))
    

    Output expected: "Eastern Daylight Time" "EST"

    What happened: "Eastern Daylight Time" "Eastern Daylight Time"

  • Add error message to TestAddInvalidFirstArgTypeIgnored

    Add error message to TestAddInvalidFirstArgTypeIgnored

    Hi there. I'm new to goment, but I love it, and it saved me from the misery of go's standard date library, so I wanted to contribute.

    I noticed the need for assertion messages on your TODO. So here's a preliminary PR to make sure I'm on the right track.

    Basically looking for feedback, and if this is helpful, I can add error messages to more assertions.

    Thanks for making this great library.

  • Stackoverflow with Tinygo

    Stackoverflow with Tinygo

    I was trying to run goment using TinyGo. I get a compile error. Here is an example to reproduce:

    
    import (
    	"fmt"
    
    	"github.com/nleeper/goment"
    )
    
    func main() {
    	JourAn, _ := goment.New(goment.DateTime{
    		Year:  2019,
    		Month: 1,
    		Day:   1,
    	})
    	fmt.Printf(JourAn.ToString())
    }```
    
    
    I get this output:
    
    
    ```runtime: goroutine stack exceeds 1000000000-byte limit
    runtime: sp=0xc028400388 stack=[0xc028400000, 0xc048400000]
    fatal error: stack overflow
    
    runtime stack:
    runtime.throw(0x812bb99, 0xe)
            /usr/local/go/src/runtime/panic.go:1117 +0x72
    runtime.newstack()
            /usr/local/go/src/runtime/stack.go:1069 +0x7ed
    runtime.morestack()
            /usr/local/go/src/runtime/asm_amd64.s:458 +0x8f
    
    goroutine 13 [running]:
    runtime.mapaccess2_fast32(0x80c7520, 0xc009778de0, 0x90c, 0x0, 0x0)
            /usr/local/go/src/runtime/map_fast32.go:52 +0x1b2 fp=0xc028400398 sp=0xc028400390 pc=0x4013792
    github.com/tinygo-org/tinygo/interp.(*memoryView).get(0xc009778db0, 0xc00000090c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
            /Users/distiller/project/interp/memory.go:225 +0xa6 fp=0xc028400460 sp=0xc028400398 pc=0x42e6466
    github.com/tinygo-org/tinygo/interp.(*memoryView).get(0xc009812450, 0x90c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
            /Users/distiller/project/interp/memory.go:229 +0x1b6 fp=0xc028400528 sp=0xc028400460 pc=0x42e6576
    github.com/tinygo-org/tinygo/interp.pointerValue.llvmValue(...)
            /Users/distiller/project/interp/memory.go:504
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:512 +0x5b fp=0xc028400668 sp=0xc028400528 pc=0x42e819b
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028400748 sp=0xc028400668 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028400888 sp=0xc028400748 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028400968 sp=0xc028400888 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028400aa8 sp=0xc028400968 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028400b88 sp=0xc028400aa8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028400cc8 sp=0xc028400b88 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028400da8 sp=0xc028400cc8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028400ee8 sp=0xc028400da8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028400fc8 sp=0xc028400ee8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028401108 sp=0xc028400fc8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc0284011e8 sp=0xc028401108 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028401328 sp=0xc0284011e8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028401408 sp=0xc028401328 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028401548 sp=0xc028401408 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028401628 sp=0xc028401548 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028401768 sp=0xc028401628 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028401848 sp=0xc028401768 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028401988 sp=0xc028401848 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028401a68 sp=0xc028401988 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028401ba8 sp=0xc028401a68 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028401c88 sp=0xc028401ba8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028401dc8 sp=0xc028401c88 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028401ea8 sp=0xc028401dc8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028401fe8 sp=0xc028401ea8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc0284020c8 sp=0xc028401fe8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028402208 sp=0xc0284020c8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc0284022e8 sp=0xc028402208 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028402428 sp=0xc0284022e8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028402508 sp=0xc028402428 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028402648 sp=0xc028402508 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028402728 sp=0xc028402648 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028402868 sp=0xc028402728 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028402948 sp=0xc028402868 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028402a88 sp=0xc028402948 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028402b68 sp=0xc028402a88 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028402ca8 sp=0xc028402b68 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028402d88 sp=0xc028402ca8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028402ec8 sp=0xc028402d88 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028402fa8 sp=0xc028402ec8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc0284030e8 sp=0xc028402fa8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc0284031c8 sp=0xc0284030e8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028403308 sp=0xc0284031c8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc0284033e8 sp=0xc028403308 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028403528 sp=0xc0284033e8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028403608 sp=0xc028403528 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028403748 sp=0xc028403608 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028403828 sp=0xc028403748 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028403968 sp=0xc028403828 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028403a48 sp=0xc028403968 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028403b88 sp=0xc028403a48 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028403c68 sp=0xc028403b88 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028403da8 sp=0xc028403c68 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028403e88 sp=0xc028403da8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028403fc8 sp=0xc028403e88 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc0284040a8 sp=0xc028403fc8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc0284041e8 sp=0xc0284040a8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc0284042c8 sp=0xc0284041e8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028404408 sp=0xc0284042c8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc0284044e8 sp=0xc028404408 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028404628 sp=0xc0284044e8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028404708 sp=0xc028404628 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028404848 sp=0xc028404708 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028404928 sp=0xc028404848 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028404a68 sp=0xc028404928 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028404b48 sp=0xc028404a68 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028404c88 sp=0xc028404b48 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028404d68 sp=0xc028404c88 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028404ea8 sp=0xc028404d68 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028404f88 sp=0xc028404ea8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc0284050c8 sp=0xc028404f88 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc0284051a8 sp=0xc0284050c8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc0284052e8 sp=0xc0284051a8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc0284053c8 sp=0xc0284052e8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028405508 sp=0xc0284053c8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc0284055e8 sp=0xc028405508 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028405728 sp=0xc0284055e8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028405808 sp=0xc028405728 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028405948 sp=0xc028405808 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028405a28 sp=0xc028405948 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028405b68 sp=0xc028405a28 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028405c48 sp=0xc028405b68 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028405d88 sp=0xc028405c48 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028405e68 sp=0xc028405d88 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028405fa8 sp=0xc028405e68 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028406088 sp=0xc028405fa8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc0284061c8 sp=0xc028406088 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc0284062a8 sp=0xc0284061c8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc0284063e8 sp=0xc0284062a8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc0284064c8 sp=0xc0284063e8 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028406608 sp=0xc0284064c8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc0284066e8 sp=0xc028406608 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028406828 sp=0xc0284066e8 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028406908 sp=0xc028406828 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028406a48 sp=0xc028406908 pc=0x42e8845
    github.com/tinygo-org/tinygo/interp.rawValue.rawLLVMValue(0xc0097c6000, 0x70, 0x70, 0xc009812450, 0x70)
            /Users/distiller/project/interp/memory.go:1045 +0x16e fp=0xc028406b28 sp=0xc028406a48 pc=0x42eb62e
    github.com/tinygo-org/tinygo/interp.pointerValue.toLLVMValue(0x90c00000040, 0x0, 0xc009812450, 0xa61a260)
            /Users/distiller/project/interp/memory.go:521 +0x705 fp=0xc028406c68 sp=0xc028406b28 pc=0x42e8845
    created by github.com/tinygo-org/tinygo/builder.runJobs
            /Users/distiller/project/builder/jobs.go:73 +0xc5
    
    goroutine 1 [chan receive]:
    github.com/tinygo-org/tinygo/builder.runJobs(0xc002c27180, 0x4, 0x4, 0x0, 0x0)
            /Users/distiller/project/builder/jobs.go:105 +0x12e
    github.com/tinygo-org/tinygo/builder.Build(0x7ffeefbffa53, 0x12, 0x8126f1d, 0x4, 0xc0001efe30, 0xc002bc1ba0, 0x0, 0x0)
            /Users/distiller/project/builder/build.go:327 +0x191d
    main.Run(0x7ffeefbffa53, 0x12, 0xc0002b2000, 0xe, 0x0)
            /Users/distiller/project/main.go:519 +0xb2
    main.main()
            /Users/distiller/project/main.go:986 +0x213b
    
    goroutine 6 [chan receive]:
    github.com/tinygo-org/tinygo/builder.jobWorker(0xc001093140, 0xc001092a80)
            /Users/distiller/project/builder/jobs.go:151 +0x91
    created by github.com/tinygo-org/tinygo/builder.runJobs
            /Users/distiller/project/builder/jobs.go:73 +0xc5
    
    goroutine 7 [chan receive]:
    github.com/tinygo-org/tinygo/builder.jobWorker(0xc001093140, 0xc001092a80)
            /Users/distiller/project/builder/jobs.go:151 +0x91
    created by github.com/tinygo-org/tinygo/builder.runJobs
            /Users/distiller/project/builder/jobs.go:73 +0xc5
    
    goroutine 8 [chan receive]:
    github.com/tinygo-org/tinygo/builder.jobWorker(0xc001093140, 0xc001092a80)
            /Users/distiller/project/builder/jobs.go:151 +0x91
    created by github.com/tinygo-org/tinygo/builder.runJobs
            /Users/distiller/project/builder/jobs.go:73 +0xc5
    
    goroutine 9 [chan receive]:
    github.com/tinygo-org/tinygo/builder.jobWorker(0xc001093140, 0xc001092a80)
            /Users/distiller/project/builder/jobs.go:151 +0x91
    created by github.com/tinygo-org/tinygo/builder.runJobs
            /Users/distiller/project/builder/jobs.go:73 +0xc5
    
    goroutine 10 [chan receive]:
    github.com/tinygo-org/tinygo/builder.jobWorker(0xc001093140, 0xc001092a80)
            /Users/distiller/project/builder/jobs.go:151 +0x91
    created by github.com/tinygo-org/tinygo/builder.runJobs
            /Users/distiller/project/builder/jobs.go:73 +0xc5
    
    goroutine 11 [chan receive]:
    github.com/tinygo-org/tinygo/builder.jobWorker(0xc001093140, 0xc001092a80)
            /Users/distiller/project/builder/jobs.go:151 +0x91
    created by github.com/tinygo-org/tinygo/builder.runJobs
            /Users/distiller/project/builder/jobs.go:73 +0xc5
    
    goroutine 12 [chan receive]:
    github.com/tinygo-org/tinygo/builder.jobWorker(0xc001093140, 0xc001092a80)
            /Users/distiller/project/builder/jobs.go:151 +0x91
    created by github.com/tinygo-org/tinygo/builder.runJobs
            /Users/distiller/project/builder/jobs.go:73 +0xc5```
  • concurrent map writes

    concurrent map writes

    fatal error: concurrent map writes

    goroutine 429 [running]: github.com/nleeper/goment.addParseReplacement({0xc0007cc970?, 0x2?, 0x2?}) /Users/lee/go/pkg/mod/github.com/nleeper/[email protected]/parse.go:258 +0x18a github.com/nleeper/goment.loadParseReplacements() /Users/lee/go/pkg/mod/github.com/nleeper/[email protected]/parse.go:116 +0x151 github.com/nleeper/goment.New({0xc0007cd248, 0x1, 0xc000382ff0?}) /Users/lee/go/pkg/mod/github.com/nleeper/[email protected]/goment.go:32 +0x3e

  • Date arithmetic error

    Date arithmetic error

    When adding time to dates, there is not parity when using the Diff function.

    package main
    
    import (
    	"fmt"
    	"github.com/nleeper/goment"
    	"time"
    )
    
    const TIME_ZONE = "America/Los_Angeles"
    
    func main() {
    	// SetLocale to ensure local specific names, start of week, etc
    	goment.SetLocale("en")
    
    	// Set timezone to be used
    	loc, err := time.LoadLocation(TIME_ZONE)
    	if err != nil {
    		fmt.Println(err)
    	}
    
    	dt, err := time.ParseInLocation(time.RFC1123, "Tue, 04 Jan 2022 16:00:00 PST", loc)
    	if err != nil {
    		fmt.Println(err)
    	}
    
    	gdt, err := goment.New(dt)
    	if err != nil {
    		fmt.Println(err)
    	}
    
    	fmt.Println("Start date:" + gdt.ToString())
    
    	for i := 2; i != 20; i += 2 {
    		t := gdt.Clone().Add(i, "weeks")
    		delta := t.Diff(gdt, "weeks")
    		fmt.Printf("Date: %s, Interval: %d, Delta: %d\n", t.ToString(), i, delta)
    	}
    }
    

    Outputs: Start date: 2022-01-04 16:00:00 -0800 PST Date: 2022-01-18 16:00:00 -0800 PST, Interval: 2, Delta: 2 Date: 2022-02-01 16:00:00 -0800 PST, Interval: 4, Delta: 4 Date: 2022-02-15 16:00:00 -0800 PST, Interval: 6, Delta: 6 Date: 2022-03-01 16:00:00 -0800 PST, Interval: 8, Delta: 8 Date: 2022-03-15 16:00:00 -0700 PDT, Interval: 10, Delta: 9 Date: 2022-03-29 16:00:00 -0700 PDT, Interval: 12, Delta: 11 Date: 2022-04-12 16:00:00 -0700 PDT, Interval: 14, Delta: 13 Date: 2022-04-26 16:00:00 -0700 PDT, Interval: 16, Delta: 15 Date: 2022-05-10 16:00:00 -0700 PDT, Interval: 18, Delta: 17

    Notice the "delta", the result of diff, show 9 weeks despite 10 being added.

  • Document making sure int are passed to the library

    Document making sure int are passed to the library

    Hello 👋 , not a bug per-se, but something that is not explicitly said: you are expecting amounts to be expressed in int. Not int32, not int64 but plain int. https://github.com/nleeper/goment/blob/main/add_subtract.go#L13 😅

    I was pulling my hair not understanding why the library was not subtracting 15min to my object. Turns out I was using .ParseInt to get my amount, and it returns... an int64.

    Time does not change:

    input := "now-15min"
    // ...
    moment, _ := goment.New() // 2021-08-05 18:22:32.422501853 +0000 UTC
    // ...
    num, _ := strconv.ParseInt(input[i:j], 10, 64) // num = 15
    // ...
    unit := string(input[i]) // unit = "m"
    
    log.Printf("Subtracting %d%s", num, unit) // Subtracting 15m
    moment.Subtract(num, unit) // 2021-08-05 18:22:32.422501853 +0000 UTC <- Unchanged
    

    Time changes:

    input := "now-15min"
    // ...
    moment, _ := goment.New() // 2021-08-05 18:33:02.429106516 +0000 UTC
    // ...
    num, _ := strconv.ParseInt(input[i:j], 10, 64) // num = 15
    // ...
    unit := string(input[i]) // unit = "m"
    
    log.Printf("Subtracting %d%s", num, unit) // Subtracting 15m
    moment.Subtract(int(num), unit) // 2021-08-05 18:18:02.429106516 +0000 UTC <- Changed
    

    Hopefully this helps anyone in my situation 😁

  • Exports list of locales

    Exports list of locales

    I'm currently using the awesome golang.org/x/text/language (see post), for matching user locale with one of the supported languages.

    userLocale := "zh-TW"
    
    // find the best matching languages, based on user locale
    languagesSupportedByGoment := []language.Tag{
        language.English,
        language.French,
        language.Spanish,
    }
    languageMatcher := language.NewMatcher(languagesSupportedByGoment)
    t, _, _ := languageMatcher.Match(language.Make(userLocale))
    base, _ := t.Base()
    
    // set the goment internal locale
    g, err := goment.New(date)
    g.SetLocale(base.String())
    

    It would be better to expose the list of available locales in this library, to allow support for future languages.

    I wonder, should we import golang.org/x/text/language into this module and offer an abstraction? 🤔

Related tags
:clock1: Date and Time - Golang Formatting Library
:clock1: Date and Time - Golang Formatting Library

Kair Date and Time - Golang Formatting Library Setup To get Kair > Go CLI go get github.com/GuilhermeCaruso/kair > Go DEP dep ensure -add github.com/G

Sep 26, 2022
Clock is a small library for mocking time in Go.

clock Clock is a small library for mocking time in Go. It provides an interface around the standard library's time package so that the application can

Dec 30, 2022
Carbon for Golang, an extension for Time

Carbon A simple extension for Time based on PHP's Carbon library. Features: Time is embedded into Carbon (provides access to all of Time's functionali

Dec 20, 2022
:clock8: Better time duration formatting in Go!

durafmt durafmt is a tiny Go library that formats time.Duration strings (and types) into a human readable format. go get github.com/hako/durafmt Why

Dec 16, 2022
Now is a time toolkit for golang

Now Now is a time toolkit for golang Install go get -u github.com/jinzhu/now Usage Calculating time based on current time import "github.com/jinzhu/n

Dec 23, 2022
Golang package to manipulate time intervals.

timespan timespan is a Go library for interacting with intervals of time, defined as a start time and a duration. Documentation API Installation Insta

Sep 26, 2022
timeutil - useful extensions (Timedelta, Strftime, ...) to the golang's time package

timeutil - useful extensions to the golang's time package timeutil provides useful extensions (Timedelta, Strftime, ...) to the golang's time package.

Dec 22, 2022
fasttime - fast time formatting for go

fasttime - fast time formatting for go

Dec 13, 2022
🌐 A time zone helper
🌐 A time zone helper

?? A time zone helper tz helps you schedule things across time zones. It is an interactive TUI program that displays time across a few time zones of y

Dec 29, 2022
A natural language date/time parser with pluggable rules

when when is a natural language date/time parser with pluggable rules and merge strategies Examples tonight at 11:10 pm at Friday afternoon the deadli

Dec 26, 2022
Copy of stdlib's time.Duration, but ParseDuration accepts other bigger units such as days, weeks, months and years

duration Copy of stdlib's time.Duration, but ParseDuration accepts other units as well: d: days (7 * 24 * time.Hour) w: weeks (7 * Day) mo: months (30

Jun 21, 2022
time format golang

a simple plugin to change date and time format

Sep 29, 2021
Structural time package for jalali calendar

Jalali Structural time package for jalali calendar. This package support parse from string, json and time. Structures There are three data structures

Mar 21, 2022
Timediff is a Go package for printing human readable, relative time differences 🕰️

timediff is a Go package for printing human readable, relative time differences. Output is based on ranges defined in the Day.js JavaScript library, and can be customized if needed.

Dec 25, 2022
Show time by timezone

Show time by timezone

Jan 22, 2022
Go-timeparser - Flexible Time Parser for Golang

go-timeparser Flexible Time Parser for Golang Installation Download timeparser w

Dec 29, 2022
timea.go (did you see what I did there?) is a simple library to print given times in

timea.go timea.go (did you see what I did there?) is a simple library to print given times in "time ago" manner. Usage Get it: go get github.com/caarl

Sep 29, 2022
Go-olson-timezone - A Golang library that tries to figure out your local timezone

go-olson-timezone A Golang library that tries to figure out your local timezone.

Feb 16, 2022
Simple cli that makes your thoughts captured in the moment.

note Simple cli that makes your thoughts captured in the moment. Install go install github.com/jnszkr/note Usage > note This is my first note that I

Jan 8, 2022
Time-Based One-Time Password (TOTP) and HMAC-Based One-Time Password (HOTP) library for Go.

otpgo HMAC-Based and Time-Based One-Time Password (HOTP and TOTP) library for Go. Implements RFC 4226 and RFC 6238. Contents Supported Operations Read

Dec 19, 2022