Skip to content

proposal: import/path: aliasing long imports #74700

@Mohammad-Nobel

Description

@Mohammad-Nobel

Proposal Details

I'm thinking about shortening long path imports by aliasing the package source path to a short descriptive import name, like this:

go.mod:
module repository1 as org1--repo1

go 1.22
---
go.mod:
module repository2 as org2--repo2

go 1.24

require github.com/organization1/repository1 v1.0.0

main.go:
package main

import (
	"fmt"
	"log"

	//"org1-repo1" "github.com/organization1/repository1"
	"org1-repo1" // just the alias
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions