Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8139261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:46:06+00:00 2026-06-06T11:46:06+00:00

I installed a test0 package to $gopath\pkg\windows_386\hello\test0.a , but when i build a main

  • 0

I installed a test0 package to $gopath\pkg\windows_386\hello\test0.a, but when i build a main package which depends on the test0 package, the compiler says: import "hello/test0": cannot find package.

why this happens?

I have two go file:

$gopath/src/hello.go

package main

import (
    "fmt"
    "hello/test0"
)

func main() {
    fmt.Println(test0.Number)
}

$gopath/src/hello/test0/test0.go

package test0

const (
    Number int = 255
)

At first, i run go install hello/test0, and it generated $gopath\pkg\windows_386\hello\test0.a

then, i delete the directory $gopath/src/hello

finally, i run go build hello.go, and the compiler sayed hello.go:5:2: import "hello/test0": cannot find package

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:46:07+00:00Added an answer on June 6, 2026 at 11:46 am

    That doesn’t seem to be normally possible for the moment : https://code.google.com/p/go/issues/detail?id=2775

    Maybe for Go1.1

    A trick (that I didn’t test) by Dave :

    For a package called “hello”, the go tool will look for .go sources in
    $GOPATH/src/hello, and only rebuild if the timestamp of the .a file is
    before the latest timestamp of the .go files. An easy way to fool it
    into accepting just the .a file is to drop a dummy .go file in the
    correct src directory and set its timestamp to before that of the .a
    file.

    (this is a community answer, using what is said on golang-nuts).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I installed the scikits package but can't import it, I am on Macbook, please
I have build a Debian package out of a Python project which depends on
I develop python application which I decided to turn into package to be installed
I have installed google test as it'is described here . But when I try
require installed gems are not visible. Test with hpricot which I installed several times:
I'm using Sublime Text 2 and installed the RubyTest package. I'm trying to run
I'm completely new to LaTeX and have the MacTeX 2009 package installed, with the
I'd like to add tests to the sdist package in my setuptools distribution, but
I wrote a simple wxPython app which I package with py2app, turning it into
I have just installed leksah following the user manual . The manual says that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.