You want os.Lstat.

> On 25 Dec 2017, at 11:36, Shulhan <m.shul...@gmail.com> wrote:
> 
> Environment
> 
> OS: Linux xenom-bubu 4.14.8-1-ARCH #1 SMP PREEMPT Wed Dec 20 21:27:44
> UTC 2017 x86_64 GNU/Linux
> 
> Go:
> - go1.10beta1 linux/amd64
> - go1.9.2
> 
> Steps to reproduce
> 
>  $ mkdir testSymlink
>  $ cd testSymlink
>  $ touch test
>  $ ln -s test link
>  $ cd ..
>  $ test -L testSymlink/link
>  # true, exit status 0
> 
> Test script bugSymlink.go,
> 
> package main
> 
> import (
>       "os"
> )
> 
> func main() {
>       in := "testSymlink/link"
> 
>       fi, err := os.Stat(in)
>       if err != nil {
>               panic(err)
>       }
> 
>       fileMode := fi.Mode()
>       if fileMode&os.ModeSymlink != 0 {
>               println(in, "is symbolic link")
>       } else {
>               println(in, "is not symbolic link")
>       }
> }
> 
>  $ go run bugSymlink.go
>  testSymlink/link is not symbolic link
> 
> Is it a bug or I miss something?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to