Groups
Groups
Sign in
Groups
Groups
golang-nuts
Conversations
About
Send feedback
Help
newbie: IsSymlink
4,382 views
Skip to first unread message
TK
unread,
May 6, 2012, 12:19:15 PM
5/6/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Hi,
to which package or type belonged the function IsSymlink (it will
return from os.Stat() earlier)?
Thanks for help.
o-o
Thomas
Dmitry Chestnykh
unread,
May 6, 2012, 12:36:33 PM
5/6/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com
Do learn if a file is a symlink, do Lstat() on it, then check its mode:
fi, err := os.Lstat(filename)
// ..check err...
if fi.Mode() & os.ModeSymlink == os.ModeSymlink {
// This is a symlink
} else {
// Not a symlink
Thomas Kaufmann
unread,
May 6, 2012, 12:38:37 PM
5/6/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com
THanx a lot!!!
Thomas Kaufmann
unread,
May 6, 2012, 12:55:40 PM
5/6/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com
And what about with fi.IsRegular?
Brad Fitzpatrick
unread,
May 6, 2012, 5:43:13 PM
5/6/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Thomas Kaufmann, golan...@googlegroups.com
From the docs on package os:
"
// Mask for the type bits. For regular files, none will be set.
ModeType = ModeDir | ModeSymlink | ModeNamedPipe | ModeSocket | ModeDevice
Thomas Kaufmann
unread,
May 7, 2012, 4:16:54 PM
5/7/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com
Thomas Kaufmann
unread,
May 7, 2012, 4:19:52 PM
5/7/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com, Thomas Kaufmann
Thanx. But I don't understand this code;-).
Thomas Kaufmann
unread,
May 7, 2012, 4:21:55 PM
5/7/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com
Devon H. O'Dell
unread,
May 7, 2012, 4:27:43 PM
5/7/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Thomas Kaufmann, golan...@googlegroups.com
2012/5/7 Thomas Kaufmann <
tok...@googlemail.com
>:
> Thanx. But I don't understand this code;-).
It means that iff ModeType == 0, it is a regular file. I suggest
reading documentation.
Please fix your mail client.
--dho
Thomas Kaufmann
unread,
May 7, 2012, 4:50:39 PM
5/7/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com, Thomas Kaufmann
Thank you.
Reply all
Reply to author
Forward
0 new messages