Skip to content

proposal: time: export time.isLeap #20944

@petrus-v

Description

@petrus-v

What version of Go are you using (go version)?

1.8.3

What operating system and processor architecture are you using (go env)?

linux / amd64

What did you do?

https://play.golang.org/p/A3bUPA268d

package main

import (
	"fmt"
	"time"
)

func main() {
	fmt.Println("Hello, playground", time.isLeap(2000))
}

I'm pretty new with golang, I wanted to progress and start some exercises from exercism.io!

the idea was to use the isLeap method from time pacakge, as far I understand function starting with low letter are not exported (public) and visible from other packages. Am I wrong?

In this huge repo, is there some rules to choose if a method should be exported or not?

What did you expect to see?

I'd like to avoid duplicate isLeap method as long Go SDK could provide it for me!

expected output

Hello, playground true

What did you see instead?

tmp/sandbox140448971/main.go:9: cannot refer to unexported name time.isLeap
tmp/sandbox140448971/main.go:9: undefined: time.isLeap

As I'm new here, I hope I haven't miss something evident! I guess this issue can be a bit controversial or subjective please close it if too many people speak (loose time) about it!

I through it's a good start to learn the contributing flow, so if some people are Ok with this proposal I would be please to follow the contributing Guide!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions